Debugger: Split into core library and application.
- Add subfolder src/kits/debugger which contains the debugger's core functionality and lower layers. Correspondingly add headers/private/debugger for shared headers to be used by clients such as the Debugger application and eventual remote_debug_server. Adjust various files to account for differences as a result of the split and moves. - Add libdebugger.so to minimal Jamfile.
This commit is contained in:
@@ -0,0 +1,233 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||
* Copyright 2011-2013, Rene Gollent, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef SETTING_H
|
||||
#define SETTING_H
|
||||
|
||||
|
||||
#include <String.h>
|
||||
|
||||
#include <ObjectList.h>
|
||||
#include <Referenceable.h>
|
||||
#include <Variant.h>
|
||||
|
||||
|
||||
enum setting_type {
|
||||
SETTING_TYPE_BOOL,
|
||||
SETTING_TYPE_FLOAT,
|
||||
SETTING_TYPE_OPTIONS,
|
||||
SETTING_TYPE_BOUNDED,
|
||||
SETTING_TYPE_RANGE,
|
||||
SETTING_TYPE_RECT
|
||||
};
|
||||
|
||||
|
||||
class Setting : public BReferenceable {
|
||||
public:
|
||||
virtual ~Setting();
|
||||
|
||||
virtual setting_type Type() const = 0;
|
||||
virtual const char* ID() const = 0;
|
||||
virtual const char* Name() const = 0;
|
||||
|
||||
virtual BVariant DefaultValue() const = 0;
|
||||
};
|
||||
|
||||
|
||||
class BoolSetting : public virtual Setting {
|
||||
public:
|
||||
virtual setting_type Type() const;
|
||||
|
||||
virtual BVariant DefaultValue() const;
|
||||
|
||||
virtual bool DefaultBoolValue() const = 0;
|
||||
};
|
||||
|
||||
|
||||
class FloatSetting : public virtual Setting {
|
||||
public:
|
||||
virtual setting_type Type() const;
|
||||
|
||||
virtual BVariant DefaultValue() const;
|
||||
|
||||
virtual float DefaultFloatValue() const = 0;
|
||||
};
|
||||
|
||||
|
||||
class SettingsOption : public BReferenceable {
|
||||
public:
|
||||
virtual ~SettingsOption();
|
||||
|
||||
virtual const char* ID() const = 0;
|
||||
virtual const char* Name() const = 0;
|
||||
};
|
||||
|
||||
|
||||
class OptionsSetting : public virtual Setting {
|
||||
public:
|
||||
virtual setting_type Type() const;
|
||||
|
||||
virtual BVariant DefaultValue() const;
|
||||
|
||||
virtual int32 CountOptions() const = 0;
|
||||
virtual SettingsOption* OptionAt(int32 index) const = 0;
|
||||
virtual SettingsOption* OptionByID(const char* id) const = 0;
|
||||
|
||||
virtual SettingsOption* DefaultOption() const = 0;
|
||||
};
|
||||
|
||||
|
||||
class BoundedSetting : public virtual Setting {
|
||||
public:
|
||||
virtual setting_type Type() const;
|
||||
|
||||
virtual BVariant LowerBound() const = 0;
|
||||
virtual BVariant UpperBound() const = 0;
|
||||
};
|
||||
|
||||
|
||||
class RangeSetting : public virtual BoundedSetting {
|
||||
virtual setting_type Type() const;
|
||||
|
||||
virtual BVariant LowerValue() const = 0;
|
||||
virtual BVariant UpperValue() const = 0;
|
||||
};
|
||||
|
||||
|
||||
class RectSetting : public virtual Setting {
|
||||
public:
|
||||
virtual setting_type Type() const;
|
||||
|
||||
virtual BVariant DefaultValue() const;
|
||||
|
||||
virtual BRect DefaultRectValue() const = 0;
|
||||
};
|
||||
|
||||
|
||||
class AbstractSetting : public virtual Setting {
|
||||
public:
|
||||
AbstractSetting(const BString& id,
|
||||
const BString& name);
|
||||
|
||||
virtual const char* ID() const;
|
||||
virtual const char* Name() const;
|
||||
|
||||
private:
|
||||
BString fID;
|
||||
BString fName;
|
||||
};
|
||||
|
||||
|
||||
class BoolSettingImpl : public AbstractSetting, public BoolSetting {
|
||||
public:
|
||||
BoolSettingImpl(const BString& id,
|
||||
const BString& name, bool defaultValue);
|
||||
|
||||
virtual bool DefaultBoolValue() const;
|
||||
|
||||
private:
|
||||
bool fDefaultValue;
|
||||
};
|
||||
|
||||
|
||||
class FloatSettingImpl : public AbstractSetting, public FloatSetting {
|
||||
public:
|
||||
FloatSettingImpl(const BString& id,
|
||||
const BString& name, float defaultValue);
|
||||
|
||||
virtual float DefaultFloatValue() const;
|
||||
|
||||
private:
|
||||
float fDefaultValue;
|
||||
};
|
||||
|
||||
|
||||
class OptionsSettingImpl : public AbstractSetting, public OptionsSetting {
|
||||
public:
|
||||
OptionsSettingImpl(const BString& id,
|
||||
const BString& name);
|
||||
virtual ~OptionsSettingImpl();
|
||||
|
||||
virtual SettingsOption* DefaultOption() const;
|
||||
|
||||
virtual int32 CountOptions() const;
|
||||
virtual SettingsOption* OptionAt(int32 index) const;
|
||||
virtual SettingsOption* OptionByID(const char* id) const;
|
||||
|
||||
bool AddOption(SettingsOption* option);
|
||||
bool AddOption(const BString& id,
|
||||
const BString& name);
|
||||
|
||||
void SetDefaultOption(SettingsOption* option);
|
||||
|
||||
private:
|
||||
class Option;
|
||||
|
||||
typedef BObjectList<SettingsOption> OptionList;
|
||||
|
||||
private:
|
||||
OptionList fOptions;
|
||||
SettingsOption* fDefaultOption;
|
||||
};
|
||||
|
||||
|
||||
class BoundedSettingImpl : public AbstractSetting, public BoundedSetting {
|
||||
public:
|
||||
BoundedSettingImpl(const BString& id,
|
||||
const BString& name,
|
||||
const BVariant& lowerBound,
|
||||
const BVariant& upperBound,
|
||||
const BVariant& defaultValue);
|
||||
|
||||
virtual BVariant DefaultValue() const;
|
||||
|
||||
virtual BVariant LowerBound() const;
|
||||
virtual BVariant UpperBound() const;
|
||||
|
||||
private:
|
||||
BVariant fLowerBound;
|
||||
BVariant fUpperBound;
|
||||
BVariant fDefaultValue;
|
||||
};
|
||||
|
||||
|
||||
class RangeSettingImpl : public AbstractSetting, public RangeSetting {
|
||||
public:
|
||||
RangeSettingImpl(const BString& id,
|
||||
const BString& name,
|
||||
const BVariant& lowerBound,
|
||||
const BVariant& upperBound,
|
||||
const BVariant& lowerValue,
|
||||
const BVariant& upperValue);
|
||||
|
||||
virtual BVariant DefaultValue() const;
|
||||
|
||||
virtual BVariant LowerBound() const;
|
||||
virtual BVariant UpperBound() const;
|
||||
virtual BVariant LowerValue() const;
|
||||
virtual BVariant UpperValue() const;
|
||||
|
||||
private:
|
||||
BVariant fLowerBound;
|
||||
BVariant fUpperBound;
|
||||
BVariant fLowerValue;
|
||||
BVariant fUpperValue;
|
||||
};
|
||||
|
||||
|
||||
class RectSettingImpl : public AbstractSetting, public RectSetting {
|
||||
public:
|
||||
RectSettingImpl(const BString& id,
|
||||
const BString& name,
|
||||
const BRect& defaultValue);
|
||||
|
||||
virtual BRect DefaultRectValue() const;
|
||||
|
||||
private:
|
||||
BRect fDefaultValue;
|
||||
};
|
||||
|
||||
|
||||
#endif // SETTING_H
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright 2013, Rene Gollent, [email protected].
|
||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef SETTINGS_H
|
||||
#define SETTINGS_H
|
||||
|
||||
|
||||
#include <Locker.h>
|
||||
#include <Message.h>
|
||||
|
||||
#include <ObjectList.h>
|
||||
#include <Referenceable.h>
|
||||
#include <Variant.h>
|
||||
|
||||
#include "Setting.h"
|
||||
|
||||
|
||||
class SettingsDescription;
|
||||
|
||||
|
||||
class Settings : public BReferenceable {
|
||||
public:
|
||||
class Listener;
|
||||
|
||||
public:
|
||||
Settings(SettingsDescription* description);
|
||||
virtual ~Settings();
|
||||
|
||||
status_t Init();
|
||||
|
||||
bool Lock() { return fLock.Lock(); }
|
||||
void Unlock() { fLock.Unlock(); }
|
||||
|
||||
SettingsDescription* Description() const { return fDescription; }
|
||||
const BMessage& Message() const { return fValues; }
|
||||
|
||||
BVariant Value(Setting* setting) const;
|
||||
BVariant Value(const char* settingID) const;
|
||||
bool SetValue(Setting* setting,
|
||||
const BVariant& value);
|
||||
|
||||
bool RestoreValues(const BMessage& message);
|
||||
|
||||
bool BoolValue(BoolSetting* setting) const
|
||||
{ return Value(setting).ToBool(); }
|
||||
SettingsOption* OptionValue(OptionsSetting* setting) const;
|
||||
BVariant RangeValue(RangeSetting* setting) const
|
||||
{ return Value(setting); }
|
||||
|
||||
bool AddListener(Listener* listener);
|
||||
void RemoveListener(Listener* listener);
|
||||
|
||||
private:
|
||||
typedef BObjectList<Listener> ListenerList;
|
||||
|
||||
private:
|
||||
mutable BLocker fLock;
|
||||
SettingsDescription* fDescription;
|
||||
BMessage fValues;
|
||||
ListenerList fListeners;
|
||||
};
|
||||
|
||||
|
||||
class Settings::Listener {
|
||||
public:
|
||||
virtual ~Listener();
|
||||
|
||||
virtual void SettingValueChanged(Setting* setting) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif // SETTINGS_H
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef SETTINGS_DESCRIPTION_H
|
||||
#define SETTINGS_DESCRIPTION_H
|
||||
|
||||
|
||||
#include <ObjectList.h>
|
||||
#include <Referenceable.h>
|
||||
|
||||
|
||||
class Setting;
|
||||
|
||||
|
||||
class SettingsDescription : public BReferenceable {
|
||||
public:
|
||||
SettingsDescription();
|
||||
virtual ~SettingsDescription();
|
||||
|
||||
int32 CountSettings() const;
|
||||
Setting* SettingAt(int32 index) const;
|
||||
Setting* SettingByID(const char* id) const;
|
||||
|
||||
bool AddSetting(Setting* setting);
|
||||
|
||||
private:
|
||||
typedef BObjectList<Setting> SettingsList;
|
||||
|
||||
private:
|
||||
SettingsList fSettings;
|
||||
};
|
||||
|
||||
|
||||
#endif // SETTINGS_DESCRIPTION_H
|
||||
Reference in New Issue
Block a user