taml_ScriptBinding.h
Engine/source/persistence/taml/taml_ScriptBinding.h
Public Functions
DefineEngineFunction(GenerateTamlSchema , bool , () , "() - Generate <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> TAML schema <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> of all engine <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">types.\n</a>" "The schema <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> is specified using the console variable '" TAML_SCHEMA_VARIABLE "'.\n" "@return Whether the schema <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> was writtent or not." )
DefineEngineFunction(TamlRead , const char * , (const char *filename, const char *format) , ("xml") , "(filename, [format]) - Read an object from <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> using <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Taml.\n</a>" "@param filename The filename <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> read <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">from.\n</a>" "@param format The <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> format <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use. Optional: Defaults <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> 'xml'. Can be set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> 'binary'.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return (<a href="/coding/file/gizmo_8h/#gizmo_8h_1a10fcd3bee2ea25191e31795e36bdeba1a5df911aaca43421a25e32c3002befbc4">Object</a>) The object read from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> or an empty string <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> read failed." )
DefineEngineFunction(TamlWrite , bool , (SimObject *simObject, const char *filename, const char *format, bool compressed) , ("xml", true) , "(object, filename, [format], [compressed]) - Writes an object <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> using <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Taml.\n</a>" "@param object The object <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">write.\n</a>" "@param filename The filename <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> write <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">to.\n</a>" "@param format The <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> format <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use. Optional: Defaults <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> 'xml'. Can be set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> 'binary'.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param compressed Whether ZIP compression is used on binary formatting or not. Optional: Defaults <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> 'true'.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return Whether the write was successful or not." )
DefineEngineMethod(Taml , getAutoFormat , bool , () , "() Gets whether the format type is automatically determined by the filename extension or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@return Whether the format type is automatically determined by the filename extension or not." )
DefineEngineMethod(Taml , getAutoFormatBinaryExtension , const char * , () , "() Gets the extension (end of filename) used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> detect the Binary <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">format.\n</a>" "@return The extension (end of filename) used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> detect the Binary format." )
DefineEngineMethod(Taml , getAutoFormatXmlExtension , const char * , () , "() Gets the extension (end of filename) used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> detect the XML <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">format.\n</a>" "@return The extension (end of filename) used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> detect the XML format." )
DefineEngineMethod(Taml , getBinaryCompression , bool , () , "() - Gets whether ZIP compression is used on binary formatting or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@return Whether ZIP compression is used on binary formatting or not." )
DefineEngineMethod(Taml , getFormat , const char * , () , "() - Gets the format that <a href="/coding/class/classtaml/">Taml</a> should use <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> read/<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">write.\n</a>" "@return The format that <a href="/coding/class/classtaml/">Taml</a> should use <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> read/write." )
DefineEngineMethod(Taml , getJSONStrict , bool , () , "() - Gets whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> write JSON that is strictly compatible with RFC4627 or not." "@return whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> write JSON that is strictly compatible with RFC4627 or not." )
DefineEngineMethod(Taml , getProgenitorUpdate , bool , () , "() Gets whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> update each type instances <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a>-progenitor or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@return Whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> update each type instances <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a>-progenitor or not." )
DefineEngineMethod(Taml , getWriteDefaults , bool , () , "() Gets whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> write static fields that are at their default or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@return Whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> write static fields that are at their default or not." )
DefineEngineMethod(Taml , read , SimObject * , (const char *filename) , "(filename) - Read an object from <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> using <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Taml.\n</a>" "@param filename The filename <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> read <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">from.\n</a>" "@return (<a href="/coding/file/gizmo_8h/#gizmo_8h_1a10fcd3bee2ea25191e31795e36bdeba1a5df911aaca43421a25e32c3002befbc4">Object</a>) The object read from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> or an empty string <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> read failed." )
DefineEngineMethod(Taml , setAutoFormat , void , (bool autoFormat) , "(autoFormat) Sets whether the format type is automatically determined by the filename extension or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@param autoFormat Whether the format type is automatically determined by the filename extension or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@return No return value." )
DefineEngineMethod(Taml , setAutoFormatBinaryExtension , void , (const char *extension) , "(extension) Sets the extension (end of filename) used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> detect the Binary <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">format.\n</a>" "@param extension The extension (end of filename) used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> detect the Binary <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">format.\n</a>" "@return No return value." )
DefineEngineMethod(Taml , setAutoFormatXmlExtension , void , (const char *extension) , "(extension) Sets the extension (end of filename) used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> detect the XML <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">format.\n</a>" "@param extension The extension (end of filename) used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> detect the XML <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">format.\n</a>" "@return No return value." )
DefineEngineMethod(Taml , setBinaryCompression , void , (bool compressed) , "(compressed) - Sets whether ZIP compression is used on binary formatting or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@param compressed Whether compression is on or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">off.\n</a>" "@return No return value." )
DefineEngineMethod(Taml , setFormat , void , (const char *formatName) , "(format) - Sets the format that <a href="/coding/class/classtaml/">Taml</a> should use <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> read/<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">write.\n</a>" "@param format The format <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use: 'xml' or 'binary'.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return No return value." )
DefineEngineMethod(Taml , setJSONStrict , void , (bool strict) , "(jsonStrict) - Sets whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> write JSON that is strictly compatible with RFC4627 or not." "@param jsonStrict Whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> write JSON that is strictly compatible with RFC4627 or not." "@return No return value." )
DefineEngineMethod(Taml , setProgenitorUpdate , void , (bool progenitorUpdate) , "(progenitorUpdate) Sets whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> update each type instances <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a>-progenitor or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "If not updating then the progenitor stay as the script that executed the call <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Taml.\n</a>" "@param progenitorUpdate Whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> update each type instances <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a>-progenitor or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@return No return value." )
DefineEngineMethod(Taml , setWriteDefaults , void , (bool writeDefaults) , "(writeDefaults) Sets whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> write static fields that are at their default or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@param writeDefaults Whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> write static fields that are at their default or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@return No return value." )
DefineEngineMethod(Taml , write , bool , (SimObject *obj, const char *filename) , "(object, filename) - Writes an object <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> using <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Taml.\n</a>" "@param object The object <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">write.\n</a>" "@param filename The filename <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> write <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">to.\n</a>" "@return Whether the write was successful or not." )
Detailed Description
Public Functions
DefineEngineFunction(GenerateTamlSchema , bool , () , "() - Generate <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> TAML schema <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> of all engine <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">types.\n</a>" "The schema <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> is specified using the console variable '" TAML_SCHEMA_VARIABLE "'.\n" "@return Whether the schema <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> was writtent or not." )
DefineEngineFunction(TamlRead , const char * , (const char *filename, const char *format) , ("xml") , "(filename, [format]) - Read an object from <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> using <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Taml.\n</a>" "@param filename The filename <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> read <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">from.\n</a>" "@param format The <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> format <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use. Optional: Defaults <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> 'xml'. Can be set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> 'binary'.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return (<a href="/coding/file/gizmo_8h/#gizmo_8h_1a10fcd3bee2ea25191e31795e36bdeba1a5df911aaca43421a25e32c3002befbc4">Object</a>) The object read from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> or an empty string <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> read failed." )
DefineEngineFunction(TamlWrite , bool , (SimObject *simObject, const char *filename, const char *format, bool compressed) , ("xml", true) , "(object, filename, [format], [compressed]) - Writes an object <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> using <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Taml.\n</a>" "@param object The object <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">write.\n</a>" "@param filename The filename <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> write <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">to.\n</a>" "@param format The <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> format <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use. Optional: Defaults <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> 'xml'. Can be set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> 'binary'.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param compressed Whether ZIP compression is used on binary formatting or not. Optional: Defaults <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> 'true'.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return Whether the write was successful or not." )
DefineEngineMethod(Taml , getAutoFormat , bool , () , "() Gets whether the format type is automatically determined by the filename extension or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@return Whether the format type is automatically determined by the filename extension or not." )
DefineEngineMethod(Taml , getAutoFormatBinaryExtension , const char * , () , "() Gets the extension (end of filename) used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> detect the Binary <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">format.\n</a>" "@return The extension (end of filename) used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> detect the Binary format." )
DefineEngineMethod(Taml , getAutoFormatXmlExtension , const char * , () , "() Gets the extension (end of filename) used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> detect the XML <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">format.\n</a>" "@return The extension (end of filename) used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> detect the XML format." )
DefineEngineMethod(Taml , getBinaryCompression , bool , () , "() - Gets whether ZIP compression is used on binary formatting or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@return Whether ZIP compression is used on binary formatting or not." )
DefineEngineMethod(Taml , getFormat , const char * , () , "() - Gets the format that <a href="/coding/class/classtaml/">Taml</a> should use <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> read/<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">write.\n</a>" "@return The format that <a href="/coding/class/classtaml/">Taml</a> should use <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> read/write." )
DefineEngineMethod(Taml , getJSONStrict , bool , () , "() - Gets whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> write JSON that is strictly compatible with RFC4627 or not." "@return whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> write JSON that is strictly compatible with RFC4627 or not." )
Gets whether to write JSON that is strictly compatible with RFC4627 or not.
return:
whether to write JSON that is strictly compatible with RFC4627 or not.
DefineEngineMethod(Taml , getProgenitorUpdate , bool , () , "() Gets whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> update each type instances <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a>-progenitor or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@return Whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> update each type instances <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a>-progenitor or not." )
DefineEngineMethod(Taml , getWriteDefaults , bool , () , "() Gets whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> write static fields that are at their default or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@return Whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> write static fields that are at their default or not." )
DefineEngineMethod(Taml , read , SimObject * , (const char *filename) , "(filename) - Read an object from <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> using <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Taml.\n</a>" "@param filename The filename <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> read <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">from.\n</a>" "@return (<a href="/coding/file/gizmo_8h/#gizmo_8h_1a10fcd3bee2ea25191e31795e36bdeba1a5df911aaca43421a25e32c3002befbc4">Object</a>) The object read from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> or an empty string <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> read failed." )
DefineEngineMethod(Taml , setAutoFormat , void , (bool autoFormat) , "(autoFormat) Sets whether the format type is automatically determined by the filename extension or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@param autoFormat Whether the format type is automatically determined by the filename extension or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@return No return value." )
DefineEngineMethod(Taml , setAutoFormatBinaryExtension , void , (const char *extension) , "(extension) Sets the extension (end of filename) used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> detect the Binary <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">format.\n</a>" "@param extension The extension (end of filename) used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> detect the Binary <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">format.\n</a>" "@return No return value." )
DefineEngineMethod(Taml , setAutoFormatXmlExtension , void , (const char *extension) , "(extension) Sets the extension (end of filename) used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> detect the XML <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">format.\n</a>" "@param extension The extension (end of filename) used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> detect the XML <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">format.\n</a>" "@return No return value." )
DefineEngineMethod(Taml , setBinaryCompression , void , (bool compressed) , "(compressed) - Sets whether ZIP compression is used on binary formatting or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@param compressed Whether compression is on or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">off.\n</a>" "@return No return value." )
DefineEngineMethod(Taml , setFormat , void , (const char *formatName) , "(format) - Sets the format that <a href="/coding/class/classtaml/">Taml</a> should use <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> read/<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">write.\n</a>" "@param format The format <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use: 'xml' or 'binary'.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return No return value." )
DefineEngineMethod(Taml , setJSONStrict , void , (bool strict) , "(jsonStrict) - Sets whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> write JSON that is strictly compatible with RFC4627 or not." "@param jsonStrict Whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> write JSON that is strictly compatible with RFC4627 or not." "@return No return value." )
Sets whether to write JSON that is strictly compatible with RFC4627 or not. Parameters:
jsonStrict | Whether to write JSON that is strictly compatible with RFC4627 or not. |
return:
No return value.
DefineEngineMethod(Taml , setProgenitorUpdate , void , (bool progenitorUpdate) , "(progenitorUpdate) Sets whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> update each type instances <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a>-progenitor or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "If not updating then the progenitor stay as the script that executed the call <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Taml.\n</a>" "@param progenitorUpdate Whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> update each type instances <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a>-progenitor or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@return No return value." )
DefineEngineMethod(Taml , setWriteDefaults , void , (bool writeDefaults) , "(writeDefaults) Sets whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> write static fields that are at their default or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@param writeDefaults Whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> write static fields that are at their default or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@return No return value." )
DefineEngineMethod(Taml , write , bool , (SimObject *obj, const char *filename) , "(object, filename) - Writes an object <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> using <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Taml.\n</a>" "@param object The object <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">write.\n</a>" "@param filename The filename <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> write <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">to.\n</a>" "@return Whether the write was successful or not." )
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2013 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23#ifndef _TAML_SCRIPTBINDING_H 24#define _TAML_SCRIPTBINDING_H 25 26#include "console/engineAPI.h" 27 28#include "persistence/taml/taml.h" 29 30DefineEngineMethod(Taml, setFormat, void, (const char* formatName), , "(format) - Sets the format that Taml should use to read/write.\n" 31 "@param format The format to use: 'xml' or 'binary'.\n" 32 "@return No return value.") 33{ 34 // Fetch format mode. 35 const Taml::TamlFormatMode formatMode = Taml::getFormatModeEnum(formatName); 36 37 // Was the format valid? 38 if ( formatMode == Taml::InvalidFormat ) 39 { 40 // No, so warn. 41 Con::warnf( "Taml::setFormat() - Invalid format mode used: '%s'.", formatName ); 42 return; 43 } 44 45 // Set format mode. 46 object->setFormatMode( formatMode ); 47} 48 49//----------------------------------------------------------------------------- 50 51DefineEngineMethod(Taml, getFormat, const char*, (), , "() - Gets the format that Taml should use to read/write.\n" 52 "@return The format that Taml should use to read/write.") 53{ 54 // Fetch format mode. 55 return Taml::getFormatModeDescription(object->getFormatMode()); 56} 57 58//----------------------------------------------------------------------------- 59 60DefineEngineMethod(Taml, setAutoFormat, void, (bool autoFormat), , "(autoFormat) Sets whether the format type is automatically determined by the filename extension or not.\n" 61 "@param autoFormat Whether the format type is automatically determined by the filename extension or not.\n" 62 "@return No return value." ) 63{ 64 object->setAutoFormat( autoFormat ); 65} 66 67//----------------------------------------------------------------------------- 68 69DefineEngineMethod(Taml, getAutoFormat, bool, (), , "() Gets whether the format type is automatically determined by the filename extension or not.\n" 70 "@return Whether the format type is automatically determined by the filename extension or not." ) 71{ 72 return object->getAutoFormat(); 73} 74 75//----------------------------------------------------------------------------- 76 77DefineEngineMethod(Taml, setWriteDefaults, void, (bool writeDefaults), , "(writeDefaults) Sets whether to write static fields that are at their default or not.\n" 78 "@param writeDefaults Whether to write static fields that are at their default or not.\n" 79 "@return No return value." ) 80{ 81 object->setWriteDefaults( writeDefaults ); 82} 83 84//----------------------------------------------------------------------------- 85 86DefineEngineMethod(Taml, getWriteDefaults, bool, (), , "() Gets whether to write static fields that are at their default or not.\n" 87 "@return Whether to write static fields that are at their default or not." ) 88{ 89 return object->getWriteDefaults(); 90} 91 92//----------------------------------------------------------------------------- 93 94DefineEngineMethod(Taml, setProgenitorUpdate, void, (bool progenitorUpdate), , "(progenitorUpdate) Sets whether to update each type instances file-progenitor or not.\n" 95 "If not updating then the progenitor stay as the script that executed the call to Taml.\n" 96 "@param progenitorUpdate Whether to update each type instances file-progenitor or not.\n" 97 "@return No return value." ) 98{ 99 object->setProgenitorUpdate( progenitorUpdate ); 100} 101 102//----------------------------------------------------------------------------- 103 104DefineEngineMethod(Taml, getProgenitorUpdate, bool, (), , "() Gets whether to update each type instances file-progenitor or not.\n" 105 "@return Whether to update each type instances file-progenitor or not." ) 106{ 107 return object->getProgenitorUpdate(); 108} 109 110//----------------------------------------------------------------------------- 111 112DefineEngineMethod(Taml, setAutoFormatXmlExtension, void, (const char* extension), , "(extension) Sets the extension (end of filename) used to detect the XML format.\n" 113 "@param extension The extension (end of filename) used to detect the XML format.\n" 114 "@return No return value." ) 115{ 116 object->setAutoFormatXmlExtension( extension ); 117} 118 119//----------------------------------------------------------------------------- 120 121DefineEngineMethod(Taml, getAutoFormatXmlExtension, const char*, (), , "() Gets the extension (end of filename) used to detect the XML format.\n" 122 "@return The extension (end of filename) used to detect the XML format." ) 123{ 124 return object->getAutoFormatXmlExtension(); 125} 126 127//----------------------------------------------------------------------------- 128 129DefineEngineMethod(Taml, setAutoFormatBinaryExtension, void, (const char* extension), , "(extension) Sets the extension (end of filename) used to detect the Binary format.\n" 130 "@param extension The extension (end of filename) used to detect the Binary format.\n" 131 "@return No return value." ) 132{ 133 object->setAutoFormatBinaryExtension( extension ); 134} 135 136//----------------------------------------------------------------------------- 137 138DefineEngineMethod(Taml, getAutoFormatBinaryExtension, const char*, (), , "() Gets the extension (end of filename) used to detect the Binary format.\n" 139 "@return The extension (end of filename) used to detect the Binary format." ) 140{ 141 return object->getAutoFormatBinaryExtension(); 142} 143 144//----------------------------------------------------------------------------- 145 146DefineEngineMethod(Taml, setBinaryCompression, void, (bool compressed), , "(compressed) - Sets whether ZIP compression is used on binary formatting or not.\n" 147 "@param compressed Whether compression is on or off.\n" 148 "@return No return value.") 149{ 150 // Set compression. 151 object->setBinaryCompression( compressed ); 152} 153 154//----------------------------------------------------------------------------- 155 156DefineEngineMethod(Taml, getBinaryCompression, bool, (), , "() - Gets whether ZIP compression is used on binary formatting or not.\n" 157 "@return Whether ZIP compression is used on binary formatting or not.") 158{ 159 // Fetch compression. 160 return object->getBinaryCompression(); 161} 162 163//----------------------------------------------------------------------------- 164 165/*! Sets whether to write JSON that is strictly compatible with RFC4627 or not. 166 @param jsonStrict Whether to write JSON that is strictly compatible with RFC4627 or not. 167 @return No return value. 168*/ 169DefineEngineMethod(Taml, setJSONStrict, void, (bool strict), , "(jsonStrict) - Sets whether to write JSON that is strictly compatible with RFC4627 or not." 170 "@param jsonStrict Whether to write JSON that is strictly compatible with RFC4627 or not." 171 "@return No return value.") 172{ 173 // Set JSON Strict. 174 object->setJSONStrict( strict ); 175} 176 177//----------------------------------------------------------------------------- 178 179/*! Gets whether to write JSON that is strictly compatible with RFC4627 or not. 180 @return whether to write JSON that is strictly compatible with RFC4627 or not. 181*/ 182DefineEngineMethod(Taml, getJSONStrict, bool, (), , "() - Gets whether to write JSON that is strictly compatible with RFC4627 or not." 183 "@return whether to write JSON that is strictly compatible with RFC4627 or not.") 184{ 185 // Get RFC strict. 186 return object->getJSONStrict(); 187} 188 189//----------------------------------------------------------------------------- 190 191DefineEngineMethod(Taml, write, bool, (SimObject* obj, const char* filename), , "(object, filename) - Writes an object to a file using Taml.\n" 192 "@param object The object to write.\n" 193 "@param filename The filename to write to.\n" 194 "@return Whether the write was successful or not.") 195{ 196 // Did we find the object? 197 if ( obj == NULL ) 198 { 199 // No, so warn. 200 Con::warnf( "Taml::write() - Tried to write a NULL object to file '%s'.", filename ); 201 return false; 202 } 203 204 return object->write( obj, filename ); 205} 206 207//----------------------------------------------------------------------------- 208 209DefineEngineMethod(Taml, read, SimObject*, (const char* filename), , "(filename) - Read an object from a file using Taml.\n" 210 "@param filename The filename to read from.\n" 211 "@return (Object) The object read from the file or an empty string if read failed.") 212{ 213 // Read object. 214 SimObject* pSimObject = object->read( filename ); 215 216 // Did we find the object? 217 if ( pSimObject == NULL ) 218 { 219 // No, so warn. 220 Con::warnf( "Taml::read() - Could not read object from file '%s'.", filename ); 221 return NULL; 222 } 223 224 return pSimObject; 225} 226 227//----------------------------------------------------------------------------- 228 229DefineEngineFunction(TamlWrite, bool, (SimObject* simObject, const char* filename, const char* format, bool compressed), 230 ("xml", true), 231 "(object, filename, [format], [compressed]) - Writes an object to a file using Taml.\n" 232 "@param object The object to write.\n" 233 "@param filename The filename to write to.\n" 234 "@param format The file format to use. Optional: Defaults to 'xml'. Can be set to 'binary'.\n" 235 "@param compressed Whether ZIP compression is used on binary formatting or not. Optional: Defaults to 'true'.\n" 236 "@return Whether the write was successful or not.") 237{ 238 239 // Did we find the object? 240 if ( simObject == NULL ) 241 { 242 // No, so warn. 243 //Con::warnf( "TamlWrite() - Could not find object '%s' to write to file '%s'.", simObject->getIdString(), filename ); 244 Con::warnf( "TamlWrite() - Could not find object to write to file '%s'.", filename ); 245 return false; 246 } 247 248 Taml taml; 249 250 taml.setFormatMode( Taml::getFormatModeEnum(format) ); 251 252 // Yes, so is the format mode binary? 253 if ( taml.getFormatMode() == Taml::BinaryFormat ) 254 { 255 // Yes, so set binary compression. 256 taml.setBinaryCompression( compressed ); 257 } 258 else 259 { 260 // No, so warn. 261 Con::warnf( "TamlWrite() - Setting binary compression is only valid for XML formatting." ); 262 } 263 264 // Turn-off auto-formatting. 265 taml.setAutoFormat( false ); 266 267 // Write. 268 return taml.write( simObject, filename ); 269} 270 271//----------------------------------------------------------------------------- 272 273DefineEngineFunction(TamlRead, const char*, (const char* filename, const char* format), ("xml"), "(filename, [format]) - Read an object from a file using Taml.\n" 274 "@param filename The filename to read from.\n" 275 "@param format The file format to use. Optional: Defaults to 'xml'. Can be set to 'binary'.\n" 276 "@return (Object) The object read from the file or an empty string if read failed.") 277{ 278 279 // Set the format mode. 280 Taml taml; 281 282 // Yes, so set it. 283 taml.setFormatMode( Taml::getFormatModeEnum(format) ); 284 285 // Turn-off auto-formatting. 286 taml.setAutoFormat( false ); 287 288 // Read object. 289 SimObject* pSimObject = taml.read( filename ); 290 291 // Did we find the object? 292 if ( pSimObject == NULL ) 293 { 294 // No, so warn. 295 Con::warnf( "TamlRead() - Could not read object from file '%s'.", filename ); 296 return StringTable->EmptyString(); 297 } 298 299 return pSimObject->getIdString(); 300} 301 302//----------------------------------------------------------------------------- 303 304DefineEngineFunction(GenerateTamlSchema, bool, (), , "() - Generate a TAML schema file of all engine types.\n" 305 "The schema file is specified using the console variable '" TAML_SCHEMA_VARIABLE "'.\n" 306 "@return Whether the schema file was writtent or not." ) 307{ 308 // Generate the schema. 309 return Taml::generateTamlSchema(); 310} 311 312#endif //_TAML_SCRIPTBINDING_H 313