Flair
Framework Libre Air
flair::core::Object Class Reference

Base class for all Framework's classes. More...

#include <Object.h>

+ Inheritance diagram for flair::core::Object:

Public Types

enum  color_t { Auto = 0, Red = 31, Green = 32, Orange = 33 }
 

Public Member Functions

 Object (const Object *parent=NULL, std::string name="", std::string type="")
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
std::string ObjectName (void) const
 Name. More...
 
std::string ObjectType (void) const
 Type. More...
 
const ObjectParent (void) const
 Parent. More...
 
std::vector< const Object * > * TypeChilds (void) const
 Childs of the same type. More...
 
std::vector< const Object * > * Childs (void) const
 Childs. More...
 
void Information (const char *function, int line, const char *format,...) const
 Formatted information. More...
 
void Warning (const char *function, const char *format,...) const
 Formatted warning. More...
 
void Error (const char *function, const char *format,...) const
 Formatted error. More...
 
bool ErrorOccured (bool recursive=true) const
 Has an errror occured? More...
 

Detailed Description

Base class for all Framework's classes.

This is the base class for all other classes.
It handles parent/child links and thus allow auto destruction of childs.

Constructor & Destructor Documentation

flair::core::Object::Object ( const Object parent = NULL,
std::string  name = "",
std::string  type = "" 
)

Constructor.

Construct an Object, which is child of its parent.

Parameters
parentparent
namename
typetype
virtual flair::core::Object::~Object ( )
virtual

Destructor.

Calling it will automatically destruct all childs.

Member Function Documentation

std::string flair::core::Object::ObjectName ( void  ) const

Name.

Returns
Object's name
std::string flair::core::Object::ObjectType ( void  ) const

Type.

Returns
Object's type
const Object* flair::core::Object::Parent ( void  ) const

Parent.

Returns
Object's parent
std::vector<const Object *>* flair::core::Object::TypeChilds ( void  ) const

Childs of the same type.

Returns
a vector of all childs of the same type
std::vector<const Object *>* flair::core::Object::Childs ( void  ) const

Childs.

Returns
a vector of all childs
void flair::core::Object::Information ( const char *  function,
int  line,
const char *  format,
  ... 
) const

Formatted information.

Green colored Printf().
Note that it is better to call Info macro, which automatically fills calling function parameter.

Parameters
functionname of calling function
lineline number in calling function
formattext string to display
void flair::core::Object::Warning ( const char *  function,
const char *  format,
  ... 
) const

Formatted warning.

Orange colored Printf().
Note that it is better to call Warn macro, which automatically fills calling function parameter.

Parameters
functionname of calling function
formattext string to display
void flair::core::Object::Error ( const char *  function,
const char *  format,
  ... 
) const

Formatted error.

Red colored Printf().
Note that it is better to call Err macro, which automatically fills function calling parameter.
After calling this method, ErrorOccured() will always return true.

Parameters
functionname of calling function
formattext string to display
bool flair::core::Object::ErrorOccured ( bool  recursive = true) const

Has an errror occured?

Check if an error occured, in fact if Error() was called at least once.
Once Error() was called, this method will never return back false.

Parameters
recursiveif true, recursively check among childs
Returns
true if an error occured