ZFFramework
 
Loading...
Searching...
No Matches
ZFPathInfo.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFPathInfo_h_
7#define _ZFI_ZFPathInfo_h_
8
10
12
13zfclassFwd _ZFP_ZFPathInfoPrivate;
36public:
40 const zfstring &pathType(void) const;
41
45 const zfstring &pathData(void) const;
46
47public:
49 zfbool isEmpty(void) const;
51 void removeAll(void);
52
53public:
55 ZFPathInfo(void);
56 ZFPathInfo(ZF_IN const zfnullT &dummy);
57 ZFPathInfo(ZF_IN const ZFPathInfo &ref);
58 ZFPathInfo(ZF_IN const zfchar *pathInfoString);
60 ~ZFPathInfo(void);
61 ZFPathInfo &operator = (ZF_IN const ZFPathInfo &ref);
62 ZFPathInfo &operator = (ZF_IN const zfnullT &dummy);
63 zfbool operator == (ZF_IN const ZFPathInfo &ref) const;
64 zfbool operator != (ZF_IN const ZFPathInfo &ref) const {return !this->operator == (ref);}
65 zfbool operator == (ZF_IN const zfnullT &dummy) const {return this->isEmpty();}
66 zfbool operator != (ZF_IN const zfnullT &dummy) const {return !this->isEmpty();}
67 inline operator zfbool (void) const {return !this->isEmpty();}
69private:
70 _ZFP_ZFPathInfoPrivate *d;
71};
72
74
75/* ZFTAG_TRICKS: tricks to make ZFMap<ZFPathInfo, xxx> works */
76inline zfint _ZFP_ZFPathInfoCompare(ZF_IN const ZFPathInfo &v0, ZF_IN const ZFPathInfo &v1) {
77 zfint t = v0.pathType().compare(v1.pathType());
78 if(t < 0) {
79 return -1;
80 }
81 else if(t > 0) {
82 return 1;
83 }
84 else {
85 t = v0.pathData().compare(v1.pathData());
86 if(t < 0) {
87 return -1;
88 }
89 else if(t > 0) {
90 return 1;
91 }
92 else {
93 return 0;
94 }
95 }
96}
97inline zfbool operator < (ZF_IN const ZFPathInfo &v0, ZF_IN const ZFPathInfo &v1) {return _ZFP_ZFPathInfoCompare(v0, v1) < 0;}
98inline zfbool operator <= (ZF_IN const ZFPathInfo &v0, ZF_IN const ZFPathInfo &v1) {return _ZFP_ZFPathInfoCompare(v0, v1) <= 0;}
99inline zfbool operator > (ZF_IN const ZFPathInfo &v0, ZF_IN const ZFPathInfo &v1) {return _ZFP_ZFPathInfoCompare(v0, v1) > 0;}
100inline zfbool operator >= (ZF_IN const ZFPathInfo &v0, ZF_IN const ZFPathInfo &v1) {return _ZFP_ZFPathInfoCompare(v0, v1) >= 0;}
101
105#define ZFPATHTYPE_DECLARE(ZFLIB_, pathType) \
106 ZFMETHOD_FUNC_INLINE_DECLARE_0(ZFLIB_, const zfstring &, ZFPathType_##pathType) { \
107 static zfstring ret = zftext(ZFM_TOSTRING(pathType)); \
108 return ret; \
109 }
110
114#define ZFPATHTYPE_DEFINE(pathType) \
115 ZFMETHOD_FUNC_INLINE_DEFINE_0(const zfstring &, ZFPathType_##pathType)
116
118
119#endif // #ifndef _ZFI_ZFPathInfo_h_
120
#define ZFLIB_ZFCore
used to export symbols
Definition ZFCoreEnvDef.h:30
_ZFT_t_zfchar zfchar
char wrapper
Definition ZFCoreTypeDef_CharType.h:17
#define zffinal
dummy macro shows that a method or class is designed must not to be overrided
Definition ZFCoreTypeDef_ClassType.h:63
#define zfclassLikePOD
shows the class is not a POD type, but you may use it like a POD except memset it to 0
Definition ZFCoreTypeDef_ClassType.h:41
#define ZF_IN
dummy macro that shows the param used as required input
Definition ZFCoreTypeDef_ClassType.h:180
#define zfclassFwd
forward declaration of a class type
Definition ZFCoreTypeDef_ClassType.h:31
#define zfnullT
type for zfnull, can be used for function overload
Definition ZFCoreTypeDef_CoreType.h:85
_ZFT_t_zfbool zfbool
bool type
Definition ZFCoreTypeDef_CoreType.h:103
_ZFT_t_zfint zfint
same as int, see zfindex
Definition ZFCoreTypeDef_CoreType.h:165
zft_zfstring< zfchar > zfstring
see zft_zfstring
Definition ZFCoreTypeDef_StringType.h:15
#define zfidentityHash(hash,...)
util method to connect multiple hash value into one hash value
Definition ZFCoreUtilMacro.h:381
#define ZFHASH_DECLARE(Type, action)
see zftHash
Definition ZFCoreUtilTemplate.h:520
zfidentity zfidentityCalcString(const zfchar *src, zfindex srcLen=((zfindex) -1))
calculate identity from string
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
types for ZFFramework
path related info storage for impl, actual meaning of the info depends on impl
Definition ZFPathInfo.h:35
ZFPathInfo & pathData(const zfstring &pathData)
path value, such as local relative path or http url, etc
ZFPathInfo & pathType(const zfstring &pathType)
path type, normal file or res file, etc
void removeAll(void)
util to remove pathType and pathData
const zfstring & pathType(void) const
path type, normal file or res file, etc
zfbool isEmpty(void) const
true if pathType and pathData is both empty
const zfstring & pathData(void) const
path value, such as local relative path or http url, etc