Changeset 129 for trunk/foundation/class_c
- Timestamp:
- Dec 1, 2006, 6:12:24 PM (19 years ago)
- Location:
- trunk/foundation/class_c
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/foundation/class_c/nomfilepath.c
r128 r129 13 13 14 14 #include "nomfilepath.ih" 15 /* 16 Append a path to the string. A path separator will be added to the current path if necessary and the 17 given string appended. If the given string starts with a separator no additional separator will be 18 added to the path prior to appending. If the given string starts with a separator and the current 19 path ends with a separator the ending separator will be removed before appending. 15 20 21 Note that there's no check if the input string is an absolute path. So if an absolute path is given as 22 input the resulting path may not be valid. 23 24 The method returns the NOMPath instance after appending. 25 */ 16 26 NOM_Scope PNOMPath NOMLINK impl_NOMPath_appendPath(NOMPath* nomSelf, const PNOMPath nomPath, CORBA_Environment *ev) 17 27 { 18 /* NOMFilePathData* nomThis=NOMFilePathGetData(nomSelf); */ 19 #warning !!!!! NOMPath_appendPath() is a stub !!!!! 20 NOMPath_appendString((NOMString*) nomSelf, (NOMString*)nomPath, NULLHANDLE); 28 gchar* chrTemp; 29 30 if(!nomPath) 31 return nomSelf; 32 33 if(0==NOMPath_length((NOMString*)nomPath, ev)) 34 return NOMPath_appendSeparator(nomSelf, ev); 35 36 if(G_DIR_SEPARATOR==chrTemp[0]) 37 NOMPath_stripSeparator(nomSelf, ev); 38 else 39 NOMPath_appendSeparator(nomSelf, ev); /* Make sure current path has a separator */ 40 41 return (NOMPath*) NOMPath_appendString((NOMString*) nomSelf, (NOMString*)nomPath, NULLHANDLE); 42 } 43 44 /* 45 Append a separator to the path. If the path already has a separator at the end this method does 46 nothing other than returning the path. 47 */ 48 NOM_Scope PNOMPath NOMLINK impl_NOMPath_appendSeparator(NOMPath* nomSelf, CORBA_Environment *ev) 49 { 50 gchar* chrTemp; 51 gulong len; 52 53 if((len=NOMPath_length((NOMString*)nomSelf, ev))==0) 54 return (NOMPath*)NOMPath_appendCString((NOMString*)nomSelf, G_DIR_SEPARATOR_S, ev); 55 56 if(G_DIR_SEPARATOR!=chrTemp[len-1]) 57 return (NOMPath*)NOMPath_appendCString( (NOMString*)nomSelf, G_DIR_SEPARATOR_S, ev); 58 21 59 return nomSelf; 22 60 } 23 61 62 /* 63 Strips the path separator from the end of a path if there's one. 64 */ 65 NOM_Scope PNOMPath NOMLINK impl_NOMPath_stripSeparator(NOMPath* nomSelf, CORBA_Environment *ev) 66 { 67 gchar* chrTemp; 68 gulong len; 69 70 if((len=NOMPath_length((NOMString*)nomSelf, ev))==0) 71 return nomSelf; 72 73 chrTemp=NOMPath_getCString((NOMString*)nomSelf, ev); 74 if(chrTemp[len-1]==G_DIR_SEPARATOR) 75 return (NOMPath*)NOMPath_truncateString( (NOMString*)nomSelf, len-1, ev); 76 77 return nomSelf; 78 } -
trunk/foundation/class_c/nomstring.c
r122 r129 62 62 } 63 63 64 /* Returns the C string held by this NOMString */64 /* Returns the C string held by this NOMString */ 65 65 NOM_Scope CORBA_string NOMLINK impl_NOMString_getCString(NOMString* nomSelf, CORBA_Environment *ev) 66 66 { … … 104 104 } 105 105 106 NOM_Scope CORBA_unsigned_long NOMLINK impl_NOMString_length(NOMString* nomSelf, CORBA_Environment *ev) 107 { 108 NOMStringData* nomThis=NOMStringGetData(nomSelf); 109 110 return _gString->len; 111 } 112 113 NOM_Scope PNOMString NOMLINK impl_NOMString_truncateString(NOMString* nomSelf, const CORBA_unsigned_long ulNewLen, 114 CORBA_Environment *ev) 115 { 116 NOMStringData* nomThis=NOMStringGetData(nomSelf); 117 118 g_string_truncate(_gString, ulNewLen); 119 120 return nomSelf; 121 } 122 123 106 124 NOM_Scope void NOMLINK impl_NOMString_nomInit(NOMString* nomSelf, CORBA_Environment *ev) 107 125 { … … 110 128 NOMString_nomInit_parent((NOMObject*)nomSelf, ev); 111 129 112 /* Alloc a n emptyGString */113 _gString=g_string_new( NULL);130 /* Alloc a zero length GString */ 131 _gString=g_string_new(""); 114 132 } 115 133
Note:
See TracChangeset
for help on using the changeset viewer.