############################# cmakepp_lang/object/serialize ############################# .. module:: cmakepp_lang/object/serialize Defines functions for serializing and printing a CMakePPLang Object. .. function:: _cpp_object_serialize(this result) Serializes an object into JSON format. This function is the default implementation for serializing an object. Derived classes are free to override it with their own implementations. This implementation simply treats the object as a map with a single key-value pair comprised of the "this" pointer (as the key) and the serialized state of the object as the value. :param this: The object we are serializing. :type this: obj :param result: Name for the identifier which will hold the serialized value. :type result: desc :returns: ``result`` will be set to the JSON serialized representation of ``this``. :var CMAKEPP_LANG_DEBUG_MODE: Used to determine if CMakePP is being run in debug mode or not. :vartype CMAKEPP_LANG_DEBUG_MODE: bool Error Checking ============== If CMakePP is run in debug mode (and only if it is) this function will assert that the caller has provided exactly two arguments and that those arguments have the correct types. If any assertion fails an error is raised. .. function:: _cpp_object_print(this) Prints an object to standard out. This function is code factorization for serializing an object and printing the serialized form to standard out. :param this: The object we are printing to standard out. :type this: obj Error Checking ============== If CMakePP is run in debug mode (and only if it is) this function will ensure that it was called with a single argument and that the argument is implicitly convertible to an Object. If either of these assertions fail an error will be raised. :var CMAKEPP_LANG_DEBUG_MODE: Used to determine if CMakePP is being run in debug mode or not. :vartype CMAKEPP_LANG_DEBUG_MODE: bool