aboutsummaryrefslogtreecommitdiff
path: root/devtools/create_project/xcode.h
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/create_project/xcode.h')
-rw-r--r--devtools/create_project/xcode.h162
1 files changed, 75 insertions, 87 deletions
diff --git a/devtools/create_project/xcode.h b/devtools/create_project/xcode.h
index c97e31064b..698b02e651 100644
--- a/devtools/create_project/xcode.h
+++ b/devtools/create_project/xcode.h
@@ -49,24 +49,23 @@ protected:
const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix);
private:
enum {
- SettingsAsList = 0x01,
- SettingsSingleItem = 0x02,
- SettingsNoQuote = 0x04,
- SettingsQuoteVariable = 0x08,
- SettingsNoValue = 0x10
+ kSettingsAsList = 0x01,
+ kSettingsSingleItem = 0x02,
+ kSettingsNoQuote = 0x04,
+ kSettingsQuoteVariable = 0x08,
+ kSettingsNoValue = 0x10
};
// File properties
struct FileProperty {
- std::string fileEncoding;
- std::string lastKnownFileType;
- std::string fileName;
- std::string filePath;
- std::string sourceTree;
-
- FileProperty(std::string fileType = "", std::string name = "", std::string path = "", std::string source = "") :
- fileEncoding(""), lastKnownFileType(fileType), fileName(name), filePath(path), sourceTree(source)
- {
+ std::string _fileEncoding;
+ std::string _lastKnownFileType;
+ std::string _fileName;
+ std::string _filePath;
+ std::string _sourceTree;
+
+ FileProperty(std::string fileType = "", std::string name = "", std::string path = "", std::string source = "")
+ : _fileEncoding(""), _lastKnownFileType(fileType), _fileName(name), _filePath(path), _sourceTree(source) {
}
};
@@ -75,33 +74,33 @@ private:
typedef std::vector<std::string> ValueList;
struct Entry {
- std::string value;
- std::string comment;
+ std::string _value;
+ std::string _comment;
- Entry(std::string val, std::string cmt) : value(val), comment(cmt) {}
+ Entry(std::string val, std::string cmt) : _value(val), _comment(cmt) {}
};
typedef std::vector<Entry> EntryList;
struct Setting {
- EntryList entries;
- int flags;
- int indent;
- int order;
+ EntryList _entries;
+ int _flags;
+ int _indent;
+ int _order;
- explicit Setting(std::string value = "", std::string comment = "", int flgs = 0, int idt = 0, int ord = -1) : flags(flgs), indent(idt), order(ord) {
- entries.push_back(Entry(value, comment));
+ Setting(std::string value = "", std::string comment = "", int flgs = 0, int idt = 0, int ord = -1) : _flags(flgs), _indent(idt), _order(ord) {
+ _entries.push_back(Entry(value, comment));
}
- explicit Setting(ValueList values, int flgs = 0, int idt = 0, int ord = -1) : flags(flgs), indent(idt), order(ord) {
+ Setting(ValueList values, int flgs = 0, int idt = 0, int ord = -1) : _flags(flgs), _indent(idt), _order(ord) {
for (unsigned int i = 0; i < values.size(); i++)
- entries.push_back(Entry(values[i], ""));
+ _entries.push_back(Entry(values[i], ""));
}
- explicit Setting(EntryList ents, int flgs = 0, int idt = 0, int ord = -1) : entries(ents), flags(flgs), indent(idt), order(ord) {}
+ Setting(EntryList ents, int flgs = 0, int idt = 0, int ord = -1) : _entries(ents), _flags(flgs), _indent(idt), _order(ord) {}
void addEntry(std::string value, std::string comment = "") {
- entries.push_back(Entry(value, comment));
+ _entries.push_back(Entry(value, comment));
}
};
@@ -109,46 +108,36 @@ private:
typedef std::pair<std::string, Setting> SettingPair;
typedef std::vector<SettingPair> OrderedSettingList;
- static bool OrderSortPredicate(const SettingPair& s1, const SettingPair& s2) {
- return s1.second.order < s2.second.order;
+ static bool OrderSortPredicate(const SettingPair &s1, const SettingPair &s2) {
+ return s1.second._order < s2.second._order;
}
struct Property {
public:
- SettingList settings;
- int flags;
- bool hasOrder;
+ SettingList _settings;
+ int _flags;
+ bool _hasOrder;
- Property() : flags(0), hasOrder(false) {}
+ Property() : _flags(0), _hasOrder(false) {}
// Constructs a simple Property
- explicit Property(std::string name, std::string value = "", std::string comment = "", int flgs = 0, int indent = 0, bool order = false) : flags(flgs), hasOrder(order) {
- Setting setting(value, comment, flags, indent);
-
- settings[name] = setting;
+ Property(std::string name, std::string value = "", std::string comment = "", int flgs = 0, int indent = 0, bool order = false) : _flags(flgs), _hasOrder(order) {
+ _settings[name] = Setting(value, comment, _flags, indent);
}
- Property(std::string name, ValueList values, int flgs = 0, int indent = 0, bool order = false) : flags(flgs), hasOrder(order) {
- Setting setting(values, flags, indent);
-
- settings[name] = setting;
- }
-
- // Copy constructor
- Property(const Property &rhs) {
- settings = rhs.settings;
- flags = rhs.flags;
+ Property(std::string name, ValueList values, int flgs = 0, int indent = 0, bool order = false) : _flags(flgs), _hasOrder(order) {
+ _settings[name] = Setting(values, _flags, indent);
}
OrderedSettingList getOrderedSettingList() {
OrderedSettingList list;
// Prepare vector to sort
- for (SettingList::const_iterator setting = settings.begin(); setting != settings.end(); ++setting)
+ for (SettingList::const_iterator setting = _settings.begin(); setting != _settings.end(); ++setting)
list.push_back(SettingPair(setting->first, setting->second));
// Sort vector using setting order
- if (hasOrder)
+ if (_hasOrder)
std::sort(list.begin(), list.end(), OrderSortPredicate);
return list;
@@ -162,48 +151,48 @@ private:
// be overkill since we only have to generate a single project
struct Object {
public:
- std::string id; // Unique identifier for this object
- std::string name; // Name (may not be unique - for ex. configuration entries)
- std::string refType; // Type of object this references (if any)
- std::string comment; // Main comment (empty for no comment)
+ std::string _id; // Unique identifier for this object
+ std::string _name; // Name (may not be unique - for ex. configuration entries)
+ std::string _refType; // Type of object this references (if any)
+ std::string _comment; // Main comment (empty for no comment)
- PropertyList properties; // List of object properties, including output configuration
+ PropertyList _properties; // List of object properties, including output configuration
// Constructs an object and add a default type property
Object(XcodeProvider *objectParent, std::string objectId, std::string objectName, std::string objectType, std::string objectRefType = "", std::string objectComment = "")
- : id(objectId), name(objectName), refType(objectRefType), comment(objectComment), parent(objectParent) {
+ : _id(objectId), _name(objectName), _refType(objectRefType), _comment(objectComment), _parent(objectParent) {
assert(objectParent);
assert(!objectId.empty());
assert(!objectName.empty());
assert(!objectType.empty());
- addProperty("isa", objectType, "", SettingsNoQuote|SettingsNoValue);
+ addProperty("isa", objectType, "", kSettingsNoQuote | kSettingsNoValue);
}
// Add a simple Property with just a name and a value
void addProperty(std::string propName, std::string propValue, std::string propComment = "", int propFlags = 0, int propIndent = 0) {
- properties[propName] = Property(propValue, "", propComment, propFlags, propIndent);
+ _properties[propName] = Property(propValue, "", propComment, propFlags, propIndent);
}
std::string toString(int flags = 0) {
std::string output;
- output = "\t\t" + parent->getHash(id) + (comment.empty() ? "" : " /* " + comment + " */") + " = {";
+ output = "\t\t" + _parent->getHash(_id) + (_comment.empty() ? "" : " /* " + _comment + " */") + " = {";
- if (flags & SettingsAsList)
+ if (flags & kSettingsAsList)
output += "\n";
// Special case: always output the isa property first
- output += parent->writeProperty("isa", properties["isa"], flags);
+ output += _parent->writeProperty("isa", _properties["isa"], flags);
// Write each property
- for (PropertyList::iterator property = properties.begin(); property != properties.end(); ++property) {
- if ((*property).first == "isa")
+ for (PropertyList::iterator property = _properties.begin(); property != _properties.end(); ++property) {
+ if (property->first == "isa")
continue;
- output += parent->writeProperty((*property).first, (*property).second, flags);
+ output += _parent->writeProperty(property->first, property->second, flags);
}
- if (flags & SettingsAsList)
+ if (flags & kSettingsAsList)
output += "\t\t";
output += "};\n";
@@ -211,37 +200,36 @@ private:
return output;
}
- // Slight hack, to allow Group access to parent.
+ // Slight hack, to allow Group access to parent.
protected:
- XcodeProvider *parent;
+ XcodeProvider *_parent;
private:
// Returns the type property (should always be the first in the properties map)
std::string getType() {
- assert(!properties.empty());
- assert(!properties["isa"].settings.empty());
-
- SettingList::iterator it = properties["isa"].settings.begin();
+ assert(!_properties.empty());
+ assert(!_properties["isa"]._settings.empty());
- return (*it).first;
+ SettingList::iterator it = _properties["isa"]._settings.begin();
+ return it->first;
}
};
struct ObjectList {
private:
- std::map<std::string, bool> objectMap;
+ std::map<std::string, bool> _objectMap;
public:
- std::vector<Object *> objects;
- std::string comment;
- int flags;
+ std::vector<Object *> _objects;
+ std::string _comment;
+ int _flags;
void add(Object *obj) {
- std::map<std::string, bool>::iterator it = objectMap.find(obj->id);
- if (it != objectMap.end() && it->second == true)
+ std::map<std::string, bool>::iterator it = _objectMap.find(obj->_id);
+ if (it != _objectMap.end() && it->second == true)
return;
- objects.push_back(obj);
- objectMap[obj->id] = true;
+ _objects.push_back(obj);
+ _objectMap[obj->_id] = true;
}
Object *find(std::string id) {
@@ -256,14 +244,14 @@ private:
std::string toString() {
std::string output;
- if (!comment.empty())
- output = "\n/* Begin " + comment + " section */\n";
+ if (!_comment.empty())
+ output = "\n/* Begin " + _comment + " section */\n";
- for (std::vector<Object *>::iterator object = objects.begin(); object != objects.end(); ++object)
- output += (*object)->toString(flags);
+ for (std::vector<Object *>::iterator object = _objects.begin(); object != _objects.end(); ++object)
+ output += (*object)->toString(_flags);
- if (!comment.empty())
- output += "/* End " + comment + " section */\n";
+ if (!_comment.empty())
+ output += "/* End " + _comment + " section */\n";
return output;
}
@@ -282,10 +270,10 @@ private:
void addChildFile(const std::string &name);
void addChildByHash(const std::string &hash, const std::string &name);
// Should be passed the hash for the entry
- void addChildGroup(const Group* group);
+ void addChildGroup(const Group *group);
void ensureChildExists(const std::string &name);
Group *getChildGroup(const std::string &name);
- std::string getHashRef() const { return parent->getHash(id); }
+ std::string getHashRef() const { return _parent->getHash(_id); }
};
// The path used by the root-source group