void prepareChildren(ZF_IN ZFUILinearLayout *layout) { for(zfindex i = 0; i < 3; ++i) { zfblockedAlloc(ZFUITextView, child); layout->childAdd(child); child->textContentStringSet(zfstringWithFormat(zfText("text %zi"), i)); child->textAlignSet(ZFUIAlign::e_Center); child->viewBackgroundColorSet(ZFUIColorRandom(255)); } layout->childAtIndex(1)->layoutParam<ZFUILinearLayoutParam *>()->layoutWeightSet(1); layout->childAtIndex(2)->layoutParam<ZFUILinearLayoutParam *>()->layoutWeightSet(2); zfblockedAlloc(ZFUILinearLayout, l); layout->childAdd(l); l->layoutOrientationSet(ZFUIOrientation::e_Bottom); for(zfindex i = 0; i < 3; ++i) { zfblockedAlloc(ZFUITextView, child); l->childAdd(child); child->textContentStringSet(zfstringWithFormat(zfText("text %zi"), 3 + i)); child->textAlignSet(ZFUIAlign::e_Center); child->viewBackgroundColorSet(ZFUIColorRandom(255)); } }
virtual const zfchar *moduleFilePath(void) { if(this->_moduleFilePath.isEmpty()) { zfstring tmp; #if ZF_ENV_sys_Windows zfcharW buf[1024] = {0}; ::GetModuleFileNameW(zfnull, buf, 1024); ZFString::toZFChar(tmp, buf, ZFStringEncodingForZFCharW); #elif ZF_ENV_sys_Posix || ZF_ENV_sys_unknown // #if ZF_ENV_sys_Windows zfcharA buf[1024] = {0}; zfint len = (zfint)::readlink(zfTextA("/proc/self/exe"), buf, 1024); if(len > 0) { buf[len] = '\0'; } else { zfscpyA(buf, zfstringWithFormat(zfTextA("./unknown")).cString()); } ZFString::toZFChar(tmp, buf, ZFStringEncoding::e_UTF8); #endif // #elif ZF_ENV_sys_Posix || ZF_ENV_sys_unknown zfbool result = ZFFile::filePathFormat(this->_moduleFilePath, tmp.cString()); zfCoreAssert(result); } return this->_moduleFilePath; }
void ZFPointerHolder::objectInfoVerboseT(ZF_IN_OUT zfstring &ret) { ret += ZFTOKEN_ZFObjectInfoLeft; ret += ZFPointerHolder::ClassData()->className(); ret += zfstringWithFormat(zfText("(%p) %p"), this, this->holdedData); ret += ZFTOKEN_ZFObjectInfoRight; }
void test(void) { this->testCaseOutput(zfLang(zfText("hello"))); this->testCaseOutput(zfLang(zfText("hello with no localized string"))); this->testCaseOutput(zfLang(zfText("hello in default only"))); this->testCaseOutput(zfLang(zfText("hello in custom only"))); this->testCaseOutput(zfstringWithFormat(zfLang(zfText("hello with format: %s")).cString(), zfText("i'm passed string"))); }