ZFFramework
 
Loading...
Searching...
No Matches
ZFStyleLoad.h File Reference

style load utility More...

#include "ZFObjectIO.h"

Go to the source code of this file.

Classes

class  ZFStyleList
 see ZFStyleLoad More...
 

Namespaces

namespace  ZFGlobalEvent
 

 

Functions

zfidentity ZFGlobalEvent::E_ZFStyleLoadItemBegin (void)
 see ZFObject::observerNotify
 
zfidentity ZFGlobalEvent::E_ZFStyleLoadItemEnd (void)
 see ZFObject::observerNotify
 
zfidentity ZFGlobalEvent::E_ZFStyleLoadItemError (void)
 see ZFObject::observerNotify
 
zfbool ZFStyleLoadCheck (const zfstring &fileName)
 check whether the item should be load as style
 
zfbool ZFStyleLoadItem (const ZFPathInfo &pathInfo, const zfstring &childPath=(zft_zfnull))
 explicitly load specified file (bypass ZFStyleLoadCheck), see ZFStyleLoad
 
zfbool ZFStyleLoadItem (ZFIOImpl *ioImpl, const zfstring &pathData, const zfstring &childPath=(zft_zfnull))
 explicitly load specified file (bypass ZFStyleLoadCheck), see ZFStyleLoad
 
zfbool ZFStyleLoadItem (const ZFSerializableData &serializableData)
 load multiple style from serializableData
 
zfbool ZFStyleLoadItem (ZFStyleList *styleList)
 see ZFStyleLoad
 
zfbool ZFStyleLoad (const ZFPathInfo &pathInfo)
 util to load multiple styles from directory
 

Detailed Description

style load utility

Function Documentation

◆ ZFStyleLoadCheck()

zfbool ZFStyleLoadCheck ( const zfstring & fileName)
extern

check whether the item should be load as style

by default, these files or dirs would be ignored:

  • files or dirs whose name start with '.' or '' (e.g. '.ignored.xml')
    • .ignored.xml
    • _ignored.xml
  • files whose name end with ''
    • ignored_.xml
    • ignored_

◆ ZFStyleLoadItem()

zfbool ZFStyleLoadItem ( const ZFSerializableData & serializableData)
extern

load multiple style from serializableData

data should contains:

<Style1 prop="styleKey1" ... />
<Style2 prop="styleKey2" ... />
see ZFStyleLoad
Definition ZFStyleLoad.h:44

the ZFStyleList is a dummy holder to make the serializable data itself serializable

◆ ZFStyleLoad()

zfbool ZFStyleLoad ( const ZFPathInfo & pathInfo)
extern

util to load multiple styles from directory

pathInfo must points to a file or directory that contains styles, example:

~/
MyStyle/
button.xml
label.json
image.png
image.xml


all styles are loaded by ZFObjectIOLoad, and ZFPathOfWithoutAllExt would be used to transform relative path to styleKey for ZFStyleSet, for example: ~/path1/path2/mybutton.123.xml would result path1/path2/mybutton as styleKey, you may also use ZFStyleLoadItem for loading single one file in deep file tree

if two item with same name exists, the later one would override the first one (but which one is later, is not ensured, try to prevent that)

by default, files or dirs would be filtered by ZFStyleLoadCheck
specially, if the loaded object is type of ZFStyleList, all of its contents would be appended to current style, instead of setting ZFStyleList itself as a style value