@@ -59,14 +59,22 @@ namespace bin2cpp
5959 std::stringBaseGenerator::lookupTemplateVariable (const std::string& name)
6060 {
6161if ( name ==" bin2cpp_output_file_macro_guard" )return getCppIncludeGuardMacroName (mContext .headerFilename );
62- if ( name ==" bin2cpp_embedded_file_class_macro_guard " )return getClassMacroGuardPrefix ();
62+ if ( name ==" bin2cpp_embedded_file_class_macro_guard_prefix " )return getClassMacroGuardPrefix ();
6363if ( name ==" bin2cpp_output_file_header" )return getHeaderTemplate ();
64+ if ( name ==" bin2cpp_filemanager_file_header" )return getHeaderTemplate (false );
65+ if ( name ==" bin2cpp_file_manager_header_file_name" )return mContext .managerHeaderFilename ;
66+ if ( name ==" bin2cpp_file_manager_macro_guard_prefix" )return getFileManagerMacroGuardPrefix ();
6467if ( name ==" bin2cpp_baseclass" )return mContext .baseClass ;
6568if ( name ==" bin2cpp_classname" )return getClassName ();
69+ if ( name ==" bin2cpp_namespace" )return mContext .codeNamespace ;
70+ if ( name ==" bin2cpp_baseclass_uppercase" )return ra::strings::Uppercase (mContext .baseClass );
71+ if ( name ==" bin2cpp_classname_uppercase" )return ra::strings::Uppercase (getClassName ());
72+ if ( name ==" bin2cpp_namespace_uppercase" )return ra::strings::Lowercase (mContext .codeNamespace );
73+ if ( name ==" bin2cpp_baseclass_lowercase" )return ra::strings::Lowercase (mContext .baseClass );
74+ if ( name ==" bin2cpp_classname_lowercase" )return ra::strings::Lowercase (getClassName ());
75+ if ( name ==" bin2cpp_namespace_lowercase" )return ra::strings::Lowercase (mContext .codeNamespace );
6676if ( name ==" bin2cpp_function_identifier" )return mContext .functionIdentifier ;
6777if ( name ==" bin2cpp_function_identifier_lowercase" )return ra::strings::Lowercase (mContext .functionIdentifier );
68- if ( name ==" bin2cpp_classname" )return getClassName ();
69- if ( name ==" bin2cpp_namespace" )return mContext .codeNamespace ;
7078if ( name ==" bin2cpp_cpp_getter_function_name" )return getGetterFunctionName ();
7179if ( name ==" bin2cpp_insert_input_file_as_code" )return getInputFileDataAsCode ();
7280if ( name ==" bin2cpp_cpp_header_include_path" )return getCppHeaderIncludePath ();
@@ -283,6 +291,17 @@ namespace bin2cpp
283291return macroGuardPrefix;
284292 }
285293
294+ std::stringBaseGenerator::getFileManagerMacroGuardPrefix ()
295+ {
296+ // define macro guard a macro matching the filename
297+ std::string output;
298+ output +=getCppIncludeGuardMacroName (mContext .codeNamespace .c_str ());// prefix the custom namespace for the file manager
299+ if ( !output.empty () )
300+ output +=" _" ;
301+ output +=getCppIncludeGuardMacroName (mContext .managerHeaderFilename );
302+ return output;
303+ }
304+
286305 std::stringBaseGenerator::getImplOfGetFileName ()
287306 {
288307 std::string output;
@@ -456,8 +475,8 @@ namespace bin2cpp
456475" \n "
457476" namespace ${bin2cpp_namespace}\n "
458477" {\n "
459- " #ifndef ${bin2cpp_embedded_file_class_macro_guard }_EMBEDDEDFILE_CLASS\n "
460- " #define ${bin2cpp_embedded_file_class_macro_guard }_EMBEDDEDFILE_CLASS\n "
478+ " #ifndef ${bin2cpp_embedded_file_class_macro_guard_prefix }_EMBEDDEDFILE_CLASS\n "
479+ " #define ${bin2cpp_embedded_file_class_macro_guard_prefix }_EMBEDDEDFILE_CLASS\n "
461480" class ${bin2cpp_baseclass}\n "
462481" {\n "
463482" public:\n "
@@ -468,7 +487,7 @@ namespace bin2cpp
468487" virtual const char * getBuffer() const = 0;\n "
469488" virtual bool save(const char * filename) const = 0;\n "
470489" };\n "
471- " #endif //${bin2cpp_embedded_file_class_macro_guard }_EMBEDDEDFILE_CLASS\n "
490+ " #endif //${bin2cpp_embedded_file_class_macro_guard_prefix }_EMBEDDEDFILE_CLASS\n "
472491" const ${bin2cpp_baseclass} & ${bin2cpp_cpp_getter_function_name}();\n "
473492" }; //${bin2cpp_namespace}\n "
474493" \n "
@@ -544,8 +563,8 @@ namespace bin2cpp
544563" #include <stddef.h>\n "
545564" #include <stdbool.h>\n "
546565" \n "
547- " #ifndef ${bin2cpp_embedded_file_class_macro_guard }_EMBEDDEDFILE_STRUCT\n "
548- " #define ${bin2cpp_embedded_file_class_macro_guard }_EMBEDDEDFILE_STRUCT\n "
566+ " #ifndef ${bin2cpp_embedded_file_class_macro_guard_prefix }_EMBEDDEDFILE_STRUCT\n "
567+ " #define ${bin2cpp_embedded_file_class_macro_guard_prefix }_EMBEDDEDFILE_STRUCT\n "
549568" typedef struct ${bin2cpp_baseclass} ${bin2cpp_baseclass};\n "
550569" typedef bool(*${bin2cpp_namespace}_load_func)();\n "
551570" typedef void(*${bin2cpp_namespace}_free_func)();\n "
@@ -561,7 +580,7 @@ namespace bin2cpp
561580" ${bin2cpp_namespace}_save_func save;\n "
562581" } ${bin2cpp_baseclass};\n "
563582" typedef ${bin2cpp_baseclass}* ${bin2cpp_baseclass}Ptr;\n "
564- " #endif //${bin2cpp_embedded_file_class_macro_guard }_EMBEDDEDFILE_STRUCT\n "
583+ " #endif //${bin2cpp_embedded_file_class_macro_guard_prefix }_EMBEDDEDFILE_STRUCT\n "
565584" ${bin2cpp_baseclass}* ${bin2cpp_cpp_getter_function_name}(void);\n "
566585" \n "
567586" #endif //${bin2cpp_output_file_macro_guard}\n "