Added flag for serializable to parser, no codegen yet
parent
5a7ee5f146
commit
c7576deb15
|
@ -37,13 +37,14 @@ struct Class {
|
|||
typedef std::map<std::string, StaticMethod> StaticMethods;
|
||||
|
||||
/// Constructor creates an empty class
|
||||
Class(bool verbose=true) : isVirtual(false), verbose_(verbose) {}
|
||||
Class(bool verbose=true) : isVirtual(false), isSerializable(false), verbose_(verbose) {}
|
||||
|
||||
// Then the instance variables are set directly by the Module constructor
|
||||
std::string name; ///< Class name
|
||||
std::vector<std::string> templateArgs; ///< Template arguments
|
||||
std::string typedefName; ///< The name to typedef *from*, if this class is actually a typedef, i.e. typedef [typedefName] [name]
|
||||
bool isVirtual; ///< Whether the class is part of a virtual inheritance chain
|
||||
bool isSerializable; ///< Whether we can use boost.serialization to serialize the class
|
||||
std::vector<std::string> qualifiedParent; ///< The *single* parent - the last string is the parent class name, preceededing elements are a namespace stack
|
||||
Methods methods; ///< Class methods
|
||||
StaticMethods static_methods; ///< Static methods
|
||||
|
|
|
@ -378,13 +378,21 @@ void Module::parseMarkup(const std::string& data) {
|
|||
throw ParseFailed((int)info.length);
|
||||
}
|
||||
|
||||
//Explicitly add methods to the classes from parents so it shows in documentation
|
||||
// Post-process classes for serialization markers
|
||||
BOOST_FOREACH(Class& cls, classes) {
|
||||
Class::Methods::iterator serialize_it = cls.methods.find("serialize");
|
||||
if (serialize_it != cls.methods.end()) {
|
||||
cls.isSerializable = true;
|
||||
cls.methods.erase(serialize_it);
|
||||
}
|
||||
}
|
||||
|
||||
// Explicitly add methods to the classes from parents so it shows in documentation
|
||||
BOOST_FOREACH(Class& cls, classes)
|
||||
{
|
||||
map<string, Method> inhereted = appendInheretedMethods(cls, classes);
|
||||
cls.methods.insert(inhereted.begin(), inhereted.end());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
|
|
@ -22,6 +22,9 @@ class Point3 {
|
|||
// static functions - use static keyword and uppercase
|
||||
static double staticFunction();
|
||||
static Point3 StaticFunctionRet(double z);
|
||||
|
||||
// enabling serialization functionality
|
||||
void serialize() const; // Just triggers a flag internally and removes actual function
|
||||
};
|
||||
|
||||
// another comment
|
||||
|
|
|
@ -251,6 +251,9 @@ TEST( wrap, parse_geometry ) {
|
|||
LONGS_EQUAL(1, m1.argLists.size());
|
||||
EXPECT_LONGS_EQUAL(0, m1.argLists.front().size());
|
||||
EXPECT(m1.is_const_);
|
||||
|
||||
// check serialization flag
|
||||
EXPECT(cls.isSerializable);
|
||||
}
|
||||
|
||||
// Test class is the third one
|
||||
|
|
Loading…
Reference in New Issue