soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SAttrCracker.h File Reference

Go to the source code of this file.

Macros

#define SOUI_ATTRS_BEGIN()
 
#define SOUI_ATTRS_END()
 
#define SOUI_ATTRS_BREAK()
 
#define ATTR_CHAIN(varname, flag)
 
#define ATTR_CHAIN_PTR(varname, flag)
 
#define ATTR_CHAIN_CLASS(cls)
 
#define ATTR_CUSTOM(attribname, func)
 
#define STRINGASBOOL(strValue)
 
#define ATTR_BOOL(attribname, varname, allredraw)
 
#define ATTR_INT(attribname, varname, allredraw)
 
#define ATTR_LAYOUTSIZE(attribname, varname, allredraw)
 
#define ATTR_LAYOUTSIZE2(attribname, varname, allredraw)
 
#define ATTR_LAYOUTSIZE4(attribname, varname, allredraw)
 
#define ATTR_MARGIN(attribname, varname, allredraw)
 
#define ATTR_RECT(attribname, varname, allredraw)
 
#define ATTR_SIZE(attribname, varname, allredraw)
 
#define ATTR_POINT(attribname, varname, allredraw)
 
#define ATTR_SPOINT(attribname, varname, allredraw)
 
#define ATTR_FLOAT(attribname, varname, allredraw)
 
#define ATTR_UINT(attribname, varname, allredraw)
 
#define ATTR_DWORD(attribname, varname, allredraw)
 
#define ATTR_WORD(attribname, varname, allredraw)
 
#define ATTR_BIT(attribname, varname, maskbit, allredraw)
 
#define ATTR_STRINGA(attribname, varname, allredraw)
 
#define ATTR_STRINGW(attribname, varname, allredraw)
 
#define ATTR_STRINGT(attribname, varname, allredraw)
 
#define ATTR_I18NSTRA(attribname, varname, allredraw)
 
#define ATTR_I18NSTRT(attribname, varname, allredraw)
 
#define ATTR_HEX(attribname, varname, allredraw)
 
#define ATTR_COLOR(attribname, varname, allredraw)
 
#define ATTR_FONT(attribname, varname, allredraw)
 
#define ATTR_ENUM_BEGIN(attribname, vartype, allredraw)
 
#define ATTR_ENUM_VALUE(enumstring, enumvalue)
 
#define ATTR_ENUM_END(varname)
 
#define ATTR_STYLE(attribname, varname, allredraw)
 
#define ATTR_SKIN(attribname, varname, allredraw)
 
#define ATTR_INTERPOLATOR(attribname, varname, allredraw)
 
#define ATTR_IMAGE(attribname, varname, allredraw)
 
#define ATTR_IMAGEAUTOREF(attribname, varname, allredraw)
 
#define ATTR_ICON(attribname, varname, allredraw)
 
#define ATTR_CHAR(attribname, varname, allredraw)
 
#define ATTR_ANIMATION(attribname, varname, allredraw)
 
#define ATTR_GRADIENT(attribname, varname, allredraw)
 

Detailed Description

Copyright (C) 2014-2050 All rights reserved.

Version
v1.0
Author
SOUI group
Date
2014/08/15

Describe 定义SOUI的XML属性解析宏

Definition in file SAttrCracker.h.

Macro Definition Documentation

◆ ATTR_ANIMATION

#define ATTR_ANIMATION ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
varname.Attach(SApplication::getSingleton().LoadAnimation(S_CW2T(strValue))); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else
static SApplication & getSingleton(void)
Definition SSingleton.h:63

Definition at line 400 of file SAttrCracker.h.

◆ ATTR_BIT

#define ATTR_BIT ( attribname,
varname,
maskbit,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
bool bSet = STRINGASBOOL(strValue); \
if (bSet) \
varname |= maskbit; \
else \
varname &= ~(maskbit); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 206 of file SAttrCracker.h.

◆ ATTR_BOOL

#define ATTR_BOOL ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
varname = STRINGASBOOL(strValue); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 64 of file SAttrCracker.h.

◆ ATTR_CHAIN

#define ATTR_CHAIN ( varname,
flag )
Value:
if (FAILED(hRet) && SUCCEEDED(hRet = varname.SetAttribute(strAttribName, strValue, bLoading))) \
{ \
hRet |= flag; \
} \
else

Definition at line 37 of file SAttrCracker.h.

◆ ATTR_CHAIN_CLASS

#define ATTR_CHAIN_CLASS ( cls)
Value:
if (FAILED(hRet)) \
hRet = cls::SetAttribute(strAttribName, strValue, bLoading);

Definition at line 51 of file SAttrCracker.h.

◆ ATTR_CHAIN_PTR

#define ATTR_CHAIN_PTR ( varname,
flag )
Value:
if (FAILED(hRet) && varname != NULL && SUCCEEDED(hRet = varname->ISetAttribute(&strAttribName, &strValue, bLoading))) \
{ \
hRet |= flag; \
} \
else

Definition at line 44 of file SAttrCracker.h.

◆ ATTR_CHAR

#define ATTR_CHAR ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
varname = *(LPCWSTR)strValue; \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 392 of file SAttrCracker.h.

◆ ATTR_COLOR

#define ATTR_COLOR ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
if (!strValue.IsEmpty()) \
{ \
varname = GETCOLOR(strValue); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else \
{ \
hRet = E_FAIL; \
} \
} \
else

Definition at line 277 of file SAttrCracker.h.

◆ ATTR_CUSTOM

#define ATTR_CUSTOM ( attribname,
func )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
hRet = func(strValue, bLoading); \
} \
else

Definition at line 55 of file SAttrCracker.h.

◆ ATTR_DWORD

#define ATTR_DWORD ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
int nRet = Str2IntW(strValue, TRUE); \
varname = (DWORD)nRet; \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 186 of file SAttrCracker.h.

◆ ATTR_ENUM_BEGIN

#define ATTR_ENUM_BEGIN ( attribname,
vartype,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
vartype varTemp; \
\
hRet = allredraw ? S_OK : S_FALSE;

Definition at line 302 of file SAttrCracker.h.

◆ ATTR_ENUM_END

#define ATTR_ENUM_END ( varname)
Value:
return E_FAIL; \
\
varname = varTemp; \
} \
else

Definition at line 314 of file SAttrCracker.h.

◆ ATTR_ENUM_VALUE

#define ATTR_ENUM_VALUE ( enumstring,
enumvalue )
Value:
if (strValue == enumstring) \
varTemp = enumvalue; \
else

Definition at line 309 of file SAttrCracker.h.

◆ ATTR_FLOAT

#define ATTR_FLOAT ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
swscanf_s(strValue, L"%f", &varname); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 167 of file SAttrCracker.h.

◆ ATTR_FONT

#define ATTR_FONT ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
varname.SetFontDesc(strValue, GetScale()); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 293 of file SAttrCracker.h.

◆ ATTR_GRADIENT

#define ATTR_GRADIENT ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
SNS::IGradient *pGradient = GETUIDEF->GetGradient(strValue); \
if (!pGradient) \
hRet = E_FAIL; \
else \
{ \
varname = pGradient; \
hRet = allredraw ? S_OK : S_FALSE; \
} \
} \
else

Definition at line 408 of file SAttrCracker.h.

◆ ATTR_HEX

#define ATTR_HEX ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
int nRet = Str2IntW(strValue, TRUE); \
varname = nRet; \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 267 of file SAttrCracker.h.

◆ ATTR_I18NSTRA

#define ATTR_I18NSTRA ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
SNS::SStringW strTmp = tr(GETSTRING(strValue)); \
varname = S_CW2A(strTmp); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 247 of file SAttrCracker.h.

◆ ATTR_I18NSTRT

#define ATTR_I18NSTRT ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
SNS::SStringW strTmp = GETSTRING(strValue); \
varname.SetText(S_CW2T(strTmp)); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 257 of file SAttrCracker.h.

◆ ATTR_ICON

#define ATTR_ICON ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
if (varname) \
DestroyIcon(varname); \
varname = LOADICON2(strValue); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 382 of file SAttrCracker.h.

◆ ATTR_IMAGE

#define ATTR_IMAGE ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
SNS::IBitmapS *pImg = LOADIMAGE2(strValue); \
if (!pImg) \
hRet = E_FAIL; \
else \
{ \
if (varname) \
varname->Release(); \
varname = pImg; \
hRet = allredraw ? S_OK : S_FALSE; \
} \
} \
else

Definition at line 350 of file SAttrCracker.h.

◆ ATTR_IMAGEAUTOREF

#define ATTR_IMAGEAUTOREF ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
SNS::IBitmapS *pImg = LOADIMAGE2(strValue); \
if (!pImg) \
hRet = E_FAIL; \
else \
{ \
varname = pImg; \
pImg->Release(); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
} \
else

Definition at line 367 of file SAttrCracker.h.

◆ ATTR_INT

#define ATTR_INT ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
int nRet = Str2IntW(strValue, TRUE); \
varname = nRet; \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 73 of file SAttrCracker.h.

◆ ATTR_INTERPOLATOR

#define ATTR_INTERPOLATOR ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
varname.Attach(CREATEINTERPOLATOR(strValue)); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 340 of file SAttrCracker.h.

◆ ATTR_LAYOUTSIZE

#define ATTR_LAYOUTSIZE ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
varname = GETLAYOUTSIZE(strValue); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 82 of file SAttrCracker.h.

◆ ATTR_LAYOUTSIZE2

#define ATTR_LAYOUTSIZE2 ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
SStringWList values; \
if (SplitString(strValue, L',', values) != 2) \
return E_INVALIDARG; \
varname[0] = GETLAYOUTSIZE(values[0]); \
varname[1] = GETLAYOUTSIZE(values[1]); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 90 of file SAttrCracker.h.

◆ ATTR_LAYOUTSIZE4

#define ATTR_LAYOUTSIZE4 ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
SStringWList values; \
if (SplitString(strValue, L',', values) != 4) \
return E_INVALIDARG; \
varname[0] = GETLAYOUTSIZE(values[0]); \
varname[1] = GETLAYOUTSIZE(values[1]); \
varname[2] = GETLAYOUTSIZE(values[2]); \
varname[3] = GETLAYOUTSIZE(values[3]); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 102 of file SAttrCracker.h.

◆ ATTR_MARGIN

#define ATTR_MARGIN ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
SStringWList values; \
if (SplitString(strValue, L',', values) != 4) \
return E_INVALIDARG; \
varname.left = GETLAYOUTSIZE(values[0]).toPixelSize(100); \
varname.top = GETLAYOUTSIZE(values[1]).toPixelSize(100); \
varname.right = GETLAYOUTSIZE(values[2]).toPixelSize(100); \
varname.bottom = GETLAYOUTSIZE(values[3]).toPixelSize(100); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 116 of file SAttrCracker.h.

◆ ATTR_POINT

#define ATTR_POINT ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
swscanf_s(strValue, L"%d,%d", &varname.x, &varname.y); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 149 of file SAttrCracker.h.

◆ ATTR_RECT

#define ATTR_RECT ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
swscanf_s(strValue, L"%d,%d,%d,%d", &varname.left, &varname.top, &varname.right, &varname.bottom); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 131 of file SAttrCracker.h.

◆ ATTR_SIZE

#define ATTR_SIZE ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
swscanf_s(strValue, L"%d,%d", &varname.cx, &varname.cy); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 140 of file SAttrCracker.h.

◆ ATTR_SKIN

#define ATTR_SKIN ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
varname = GETSKIN(strValue, GetScale()); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 331 of file SAttrCracker.h.

◆ ATTR_SPOINT

#define ATTR_SPOINT ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
swscanf_s(strValue, L"%f,%f", &varname.fX, &varname.fY); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 158 of file SAttrCracker.h.

◆ ATTR_STRINGA

#define ATTR_STRINGA ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
SNS::SStringW strTmp = GETSTRING(strValue); \
varname = S_CW2A(strTmp); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 219 of file SAttrCracker.h.

◆ ATTR_STRINGT

#define ATTR_STRINGT ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
varname = S_CW2T(GETSTRING(strValue)); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 238 of file SAttrCracker.h.

◆ ATTR_STRINGW

#define ATTR_STRINGW ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
varname = GETSTRING(strValue); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 229 of file SAttrCracker.h.

◆ ATTR_STYLE

#define ATTR_STYLE ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
GETSTYLE(strValue, varname); \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 322 of file SAttrCracker.h.

◆ ATTR_UINT

#define ATTR_UINT ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
int nRet = Str2IntW(strValue, TRUE); \
varname = (UINT)nRet; \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 176 of file SAttrCracker.h.

◆ ATTR_WORD

#define ATTR_WORD ( attribname,
varname,
allredraw )
Value:
if (0 == strAttribName.CompareNoCase(attribname)) \
{ \
int nRet = Str2IntW(strValue, TRUE); \
varname = (WORD)nRet; \
hRet = allredraw ? S_OK : S_FALSE; \
} \
else

Definition at line 196 of file SAttrCracker.h.

◆ SOUI_ATTRS_BEGIN

#define SOUI_ATTRS_BEGIN ( )
Value:
public: \
virtual HRESULT SetAttribute(const SNS::SStringW &strAttribName, const SNS::SStringW &strValue, BOOL bLoading = FALSE) \
{ \
HRESULT hRet = E_FAIL;

Definition at line 18 of file SAttrCracker.h.

◆ SOUI_ATTRS_BREAK

#define SOUI_ATTRS_BREAK ( )
Value:
hRet = E_NOTIMPL; \
return hRet; \
}

Definition at line 32 of file SAttrCracker.h.

◆ SOUI_ATTRS_END

#define SOUI_ATTRS_END ( )
Value:
if (FAILED(hRet)) \
return __baseCls::SetAttribute(strAttribName, strValue, bLoading); \
return AfterAttribute(strAttribName.c_str(), strValue.c_str(), bLoading, hRet); \
}

Definition at line 25 of file SAttrCracker.h.

◆ STRINGASBOOL

#define STRINGASBOOL ( strValue)
Value:
(strValue).CompareNoCase(L"0") != 0 && (strValue).CompareNoCase(L"false") != 0

Definition at line 62 of file SAttrCracker.h.