@@ -13,7 +13,8 @@ string CodeGenResouceBirdge::genResourceBridgeClass(){
1313 content.append (" #define __OpenAtlasResourceBridge__\n " );
1414 content.append (" class OpenAtlasResourceBridge{\n " );
1515 content.append (" public:\n " );
16- content.append (" int getResourceId(std::string type,std::string resName);" );
16+ content.append (" int getResourceId(std::string type,std::string resName);\n " );
17+ content.append (" void cacheSharedResource();\n " );
1718 content.append (" };\n " );
1819 content.append (" #endif /* defined(__OpenAtlasResourceBridge__) */" );
1920
@@ -50,3 +51,48 @@ string CodeGenResouceBirdge::genFunctionBridge_getResource(){
5051
5152 return content;
5253};
54+ // procese shared resource
55+ string CodeGenResouceBirdge::genFunctionBridge_AnalyticsSharedResource (){
56+ string content (" //auto gen function OpenAtlasResourceBridge::AnalyticsSharedResource\n " );
57+ content.append (" void cacheSharedResource(){\n " );
58+ CodeGen mCodeGen ;
59+ content.append (" std::string dumpline;\n " );
60+ content.append (" std::string type;\n " );
61+ // std::istringstream streamStr(ret);
62+ // std::string line;
63+ // string type="";
64+ // while (std::getline(streamStr, line)) {
65+ //
66+ // //gen class
67+ // if (line.find("final class") != string::npos) {
68+ //
69+ // type=getInfoType(line);
70+ //
71+ // }
72+ //
73+ // if (line.find("public static final int") != string::npos) {
74+ content.append (" while (std::getline(streamStr, dumpline)) {\n " );
75+ content.append (" if (line.find(\" final class\" ) != string::npos) {\n\n " );
76+ content.append (" type=getIDType(line);" );
77+ content.append (" \n }\n " );
78+ content.append (" if (line.find(\" public static final int\" ) != string::npos) {\n " );
79+ int arrayIndex=0 ;
80+ for (arrayIndex=0 ;arrayIndex< sizeof ( mCodeGen .resTypeList )/sizeof (string);arrayIndex++){
81+ string funName ( mCodeGen .resTypeList [arrayIndex]);
82+ // f
83+ content.append (" if (!type.compare(\" " ).append (funName);
84+ content.append (" \" )){\n " );
85+ funName[0 ] = toupper (funName[0 ]);
86+ content.append (" OpenAtlasResource::getInstance()->set" ).append (funName);
87+ content.append (" (getSharedId(dumpline),getSharedValue(dumpline)" );
88+ content.append ( " );\n " );
89+ content.append (" }else\n " );
90+
91+
92+ }
93+ content.append (" {}\n " );
94+ content.append (" }\n }\n " );
95+ content.append (" };\n\n " );
96+
97+ return content;
98+ };
0 commit comments