示例#1
0
文件: strtest.c 项目: kaiaie/bile
int main(int argc, char *argv[]){
   String s1;
   String s2;
   char   *c1 = NULL;
   
   s1 = new_String("This ");
   s2 = new_String("is a test");
   
   if(!String_appendString(s1, s2)){
      fprintf(stderr, "String_appendString(): Uh oh!\n");
   }
   else{
      if(String_getChars(s1, &c1)){
         printf("%s\n", c1);
      }
      else{
         fprintf(stderr, "String_getChars(): Uh oh!\n");
      }
   }
   
   delete_String(s1);
   delete_String(s2);
   
   return EXIT_SUCCESS;
}
示例#2
0
文件: attrlist.c 项目: kaiaie/bile
bool AttrList_deleteItem(AttrList l, String key){
   bool   retVal = true;
   bool   found;
   bool   identical;
   String s;
   size_t i;
   int    idx = -1;

   idx = getIndex(l);
   if(idx >= 0){
      found     = false;
      for(i = 0; i < attrListPool[idx].size; ++i){
         s = attrListPool[idx].keys[i];
         if(s != INVALID_STRING){
            if(String_equalsIgnoreCase(s, key, &identical)){
               if(identical){
                  found = true;
                  break;
               }
            }
            else{
               break;
            }
         }
      }
      if(found){
         delete_String(attrListPool[idx].keys[i]);
         attrListPool[idx].keys[i] = INVALID_STRING;
         attrListPool[idx].length--;
         retVal = true;
      }
   }
   return retVal;
}
示例#3
0
void testString ( testStruct const* obj )
{
  size_t size = 2048;
  String* st = new_String ( size, "" );
  outStream* os = new_outStreamString ( st );

  printf ( "\noutput to String\n" );
  testStructEncode ( os, "myTestStruct", obj );
  printf ( "%s\n", st -> chars );

  delete_String ( st );
  delete_outStream ( os );
}
示例#4
0
void destroyGaugeQCDML(String *st){
  delete_String ( st );
}