MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / __hxcpp_resource_string

Function __hxcpp_resource_string

src/hx/StdLibs.cpp:128–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128String __hxcpp_resource_string(String inName)
129{
130 if (sgResources)
131 for(Resource *reso = sgResources; reso->mData; reso++)
132 {
133 if (reso->mName == inName)
134 #if (HXCPP_API_LEVEL > 0)
135 {
136 #ifdef HX_SMART_STRINGS
137 const unsigned char *p = reso->mData;
138 for(int i=0;i<reso->mDataLength;i++)
139 if (p[i]>127)
140 return String::create((const char *)p, reso->mDataLength);
141 #endif
142 return String((const char *) reso->mData, reso->mDataLength );
143 }
144 #else
145 return String::create((const char *) reso->mData, reso->mDataLength );
146 #endif
147 }
148
149 if (sgSecondResources)
150 {
151 for(Resource *reso = sgSecondResources; reso->mData; reso++)
152 if (reso->mName == inName)
153 {
154 #ifdef HX_SMART_STRINGS
155 const unsigned char *p = reso->mData;
156 for(int i=0;i<reso->mDataLength;i++)
157 if (p[i]>127)
158 return _hx_utf8_to_utf16(p, reso->mDataLength,false);
159 #endif
160 return String((const char *) reso->mData, reso->mDataLength );
161
162 return String((const char *) reso->mData, reso->mDataLength );
163 }
164 }
165 return null();
166}
167
168Array<unsigned char> __hxcpp_resource_bytes(String inName)
169{

Callers

nothing calls this directly

Calls 3

_hx_utf8_to_utf16Function · 0.85
StringClass · 0.50
nullClass · 0.50

Tested by

no test coverage detected