diff options
Diffstat (limited to '')
-rw-r--r-- | src/file.cpp | 7 | ||||
-rw-r--r-- | src/file.h | 7 | ||||
-rw-r--r-- | src/tafnode.cpp | 10 | ||||
-rw-r--r-- | src/tafnode.h | 2 |
4 files changed, 20 insertions, 6 deletions
diff --git a/src/file.cpp b/src/file.cpp index 5049bbb..417c445 100644 --- a/src/file.cpp +++ b/src/file.cpp | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <sys/stat.h> | 11 | #include <sys/stat.h> |
12 | #include <fcntl.h> | 12 | #include <fcntl.h> |
13 | #include <unistd.h> | 13 | #include <unistd.h> |
14 | #include <stdlib.h> // for mkstemp | ||
14 | 15 | ||
15 | namespace Bu { subExceptionDef( FileException ) } | 16 | namespace Bu { subExceptionDef( FileException ) } |
16 | 17 | ||
@@ -150,6 +151,12 @@ void Bu::File::setBlocking( bool bBlocking ) | |||
150 | } | 151 | } |
151 | 152 | ||
152 | #ifndef WIN32 | 153 | #ifndef WIN32 |
154 | Bu::File Bu::File::tempFile( Bu::FString &sName, int /*iFlags*/ ) | ||
155 | { | ||
156 | int afh_d = mkstemp( sName.getStr() ); | ||
157 | |||
158 | return Bu::File( afh_d ); | ||
159 | } | ||
153 | void Bu::File::truncate( long nSize ) | 160 | void Bu::File::truncate( long nSize ) |
154 | { | 161 | { |
155 | ftruncate( fd, nSize ); | 162 | ftruncate( fd, nSize ); |
@@ -76,12 +76,7 @@ namespace Bu | |||
76 | *@returns (Bu::File) A file object representing your temp file. | 76 | *@returns (Bu::File) A file object representing your temp file. |
77 | */ | 77 | */ |
78 | #ifndef WIN32 | 78 | #ifndef WIN32 |
79 | inline static Bu::File tempFile( Bu::FString &sName, int /*iFlags*/ ) | 79 | static Bu::File tempFile( Bu::FString &sName, int iFlags ); |
80 | { | ||
81 | int afh_d = mkstemp( sName.getStr() ); | ||
82 | |||
83 | return Bu::File( afh_d ); | ||
84 | } | ||
85 | 80 | ||
86 | /** | 81 | /** |
87 | * Set the size of the file to (nSize). You can either grow or shrink | 82 | * Set the size of the file to (nSize). You can either grow or shrink |
diff --git a/src/tafnode.cpp b/src/tafnode.cpp index 128355a..829a8e1 100644 --- a/src/tafnode.cpp +++ b/src/tafnode.cpp | |||
@@ -104,6 +104,11 @@ Bu::TafProperty *Bu::TafGroup::addProperty( | |||
104 | return addChild( new TafProperty( sName, sValue ) ); | 104 | return addChild( new TafProperty( sName, sValue ) ); |
105 | } | 105 | } |
106 | 106 | ||
107 | bool Bu::TafGroup::hasChild( const Bu::FString &sName ) const | ||
108 | { | ||
109 | return hChildren.has( sName ); | ||
110 | } | ||
111 | |||
107 | const Bu::TafGroup::GroupList &Bu::TafGroup::getChildren( const Bu::FString &sName ) const | 112 | const Bu::TafGroup::GroupList &Bu::TafGroup::getChildren( const Bu::FString &sName ) const |
108 | { | 113 | { |
109 | return hChildren.get( sName ); | 114 | return hChildren.get( sName ); |
@@ -119,6 +124,11 @@ const Bu::TafGroup *Bu::TafGroup::getChild( const Bu::FString &sName ) const | |||
119 | return hChildren.get( sName ).first(); | 124 | return hChildren.get( sName ).first(); |
120 | } | 125 | } |
121 | 126 | ||
127 | bool Bu::TafGroup::hasProperty( const Bu::FString &sName ) const | ||
128 | { | ||
129 | return hProp.has( sName ); | ||
130 | } | ||
131 | |||
122 | const Bu::TafGroup::PropList &Bu::TafGroup::getProperties( const Bu::FString &sName ) const | 132 | const Bu::TafGroup::PropList &Bu::TafGroup::getProperties( const Bu::FString &sName ) const |
123 | { | 133 | { |
124 | return hProp.get( sName ); | 134 | return hProp.get( sName ); |
diff --git a/src/tafnode.h b/src/tafnode.h index 526ef68..f6d2ea9 100644 --- a/src/tafnode.h +++ b/src/tafnode.h | |||
@@ -62,10 +62,12 @@ namespace Bu | |||
62 | const Bu::FString &getName() const; | 62 | const Bu::FString &getName() const; |
63 | void setName( const Bu::FString &sName ); | 63 | void setName( const Bu::FString &sName ); |
64 | 64 | ||
65 | bool hasProperty( const Bu::FString &sName ) const; | ||
65 | const Bu::FString &getProperty( const Bu::FString &sName ) const; | 66 | const Bu::FString &getProperty( const Bu::FString &sName ) const; |
66 | const Bu::FString &getProperty( const Bu::FString &sName, | 67 | const Bu::FString &getProperty( const Bu::FString &sName, |
67 | const Bu::FString &sDef ) const; | 68 | const Bu::FString &sDef ) const; |
68 | const PropList &getProperties( const Bu::FString &sName ) const; | 69 | const PropList &getProperties( const Bu::FString &sName ) const; |
70 | bool hasChild( const Bu::FString &sName ) const; | ||
69 | const TafGroup *getChild( const Bu::FString &sName ) const; | 71 | const TafGroup *getChild( const Bu::FString &sName ) const; |
70 | const GroupList &getChildren( const Bu::FString &sName ) const; | 72 | const GroupList &getChildren( const Bu::FString &sName ) const; |
71 | TafNode *addChild( TafNode *pNode ); | 73 | TafNode *addChild( TafNode *pNode ); |