In the following text, a the following class is assumed:
class MyClass : public MyParentClass
This class is assumed to have members:
type MyMember; anotherType MyOtherMember; // yetAnotherType MyInheritedMember is inherited from MyParentClass
and a method
bool myMethod( const int& arg1, unsigned& arg2 ) const;
Automated behaviours are a key feature of XmlCppClassGenerator: for instance automatic methods can be generated from the class members, the constructors' bodies are generated from the parent class(es) and the members, and the comments can also be generated automatically (partially of course, XmlCppClassGenerator will not guess what you want to be written in the comment) for instance.
Table of contents:
For each member added to a class, up to four method can be added automatically, without any additional <method>
elements. These methods are:
const type& myMember() const;
is created, with an appropriated comment.
* the "standard setter", i.e.
void setMyMember( const type& myMember );
is created with correct comment.
* the "pointer getter", i.e.
const type* myMemberPtr() const;
is created with correct comment.
* the "pointer setter", i.e.
void setMyMemberPtr( const type* myMember );
is created with correct comment.
Unrelated to member, there are other automatic methods:
virtual ~!MyClass();
MyClass& operator=( const MyClass myClass );
MyClass& MyClass::operator==( const MyClass& myClass ) const;
For any generated constructor, the following body will be created:
MyClass::MyClass( /* any arguments */ ) : MyParentClass( ), MyMember( ), MyOtherMember( ) {}
Additionally, a copy constructor can be added, and it body it also automatically generated:
MyClass::MyClass( const MyClass& myClass ) : MyParentClass( myClass ), MyMember( myClass.myMember() ), MyOtherMember( myClass.myOtherMember() ) {}
The affectation operator body is:
MyClass& MyClass::operator=( const MyClass& myClass ) { this -> MyParentClass::operator=( myClass ); MyMember = myClass.myMember(); MyOtherMember = myClass.myOtherMember(); return *this; }
The comparison operator is:
MyClass& MyClass::operator==( const MyClass& myClass ) const { if ( ! this -> MyParentClass::operator==( myClass ) ) return false; if ( MyMember == myClass.myMember() && MyOtherMember == myClass.myOtherMember() ) return true; return false; }
For each constructor, method and member a minimalist doxygen comment is added if <comments> false </comments>
is not present in the XML class description file. For the members, the comments are empty, i.e.:
/** * */
For methods, the list of arguments is used:
/** * * @param[in] arg1 * @param[out] arg2 */ bool myMethod( const int& arg1, unsigned& arg2 ) const;
Note that the [in]
/[out]
option is guessed from the const
and &
type modifier of the argument, which can lead to wrong identification.
For constructors / destructor, the first list contains either "Constructor" or "Destructor" (or the appropriate translation).