Example #1
0
String Path::ExtractPathFromCmdLine(String& input)
{
	String r;
	input.Trim();
	bool q = input[0] == '"';
	size_t i = q ? 1 : 0;
	while(i < input.size())
	{
		if(q)
		{
			if(input[i] == '"')
			{
				break;
			}
		}
		else
		{
			if(input[i] == ' ')
			{
				break;
			}
		}
		r += input[i];
		i++;
	}
	input.erase(input.begin(), input.begin() + r.size() + (q ? 2 : 0));
	input.Trim();
	return r;
}
Example #2
0
void testReadLine()
{
    IFILE filePtr = ifopen("testFiles/testFile.txt", "rb");
    assert(filePtr != NULL);
    
    String line = "";
    line.ReadLine(filePtr);

    assert(line == "  Hello, I am a testFile.  ");

    line.Trim();
    assert(line == "Hello, I am a testFile.");


    // Does not compile in current version, but compiles in old verison.
    // This can be added back in to ensure that it will catch the difference
    // in return value for ReadLine (now: int; used to be: string&)
    //    testMethod(line.ReadLine(filePtr));
    line.ReadLine(filePtr);
    assert(temp1 == 0);
    testMethod(line);
    assert(temp1 == 1);

    //    line.ReadLine(filePtr).Trim();
    line.ReadLine(filePtr);
    line.Trim();

    assert(line == "ThirdLine.");

    ifclose(filePtr);
}
Example #3
0
BOOL PlayerWarcraft::SetParams(map<String, String> params)
{
	if (!Activity::SetParams(params))
	{
		return FALSE;
	}

	String sBulletNum = params[TEXT("bullet_num")], sBulletDelay = params[TEXT("bullet_delay")];
	String sBulletImg = params[TEXT("bullet_img")], sBulletSpeed = params[TEXT("bullet_speed")], sBulletAudio = params[TEXT("bullet_audio")];
	String sDestroyImg = params[TEXT("destroy_img")], sDestroyAudio = params[TEXT("destroy_audio")];
	String sMuzzleType = params[TEXT("muzzle_type")];
	String sMuzzleMiddleOffset = params[TEXT("muzzle_middle_offset")], sMuzzleLeftOffset = params[TEXT("muzzle_left_offset")], sMuzzleRightOffset = params[TEXT("muzzle_right_offset")];

	sBulletImg.Trim();
	sBulletAudio.Trim();
	sDestroyImg.Trim();
	sDestroyAudio.Trim();
	
	if (!sBulletNum.IsEmpty())          mBulletNum = sBulletNum.ToUInt();
	if (!sBulletDelay.IsEmpty())        mBulletDelay = sBulletDelay.ToFloat();
	if (!sBulletImg.IsEmpty())          mBulletImg = sBulletImg;
	if (!sBulletSpeed.IsEmpty())        mBulletSpeed = sBulletSpeed.ToUInt();
	if (!sBulletAudio.IsEmpty())        mBulletAudio = sBulletAudio;
	if (!sDestroyImg.IsEmpty())         mDestroyImg = sDestroyImg;
	if (!sDestroyAudio.IsEmpty())       mDestroyAudio = sDestroyAudio;
	if (!sMuzzleType.IsEmpty())         mMuzzleType = sMuzzleType.ToUInt();
	if (!sMuzzleMiddleOffset.IsEmpty()) mMuzzleMiddleOffset = sMuzzleMiddleOffset.ToInt();
	if (!sMuzzleLeftOffset.IsEmpty())   mMuzzleLeftOffset = sMuzzleLeftOffset.ToInt();
	if (!sMuzzleRightOffset.IsEmpty())  mMuzzleRightOffset = sMuzzleRightOffset.ToInt();

	return TRUE;
}
Example #4
0
bool INIFile::GetINI(const String& sField, const String& sKey, String& sValue)
{
	SetPosition(0);
	
	String sTemp;

	// Go to the field
	while(true)
	{
		if(IsFileEOF())
		{
			return false;
		}

		sTemp = ReadLine();
		sTemp.Trim();

		if(sTemp == ("[" + sField + "]"))
		{
			break;
		}
	};

	// Go to the key
	String::size_type PosOfSep;
	while(true)
	{
		if(IsFileEOF())
		{
			return false;
		}

		sTemp = ReadLine();
		if(sTemp.IfContain("["))
		{
			return false;
		}

		PosOfSep = sTemp.find('=');
		if(PosOfSep == String::npos)  // Á¬¡°=¡±ºÅ¶¼Ã»ÓÐ
		{
			continue;
		}
		// Check out whether the key is exactly the key
		String key = sTemp.substr(0, PosOfSep);
		key.Trim();
		if(key == sKey)
		{
			break;
		}
	};
	
	// Extract out the value
	sValue = sTemp.substr(PosOfSep + 1);
	sValue.Trim();

	return !sValue.empty();
}
Example #5
0
   Macro 
   MacroParser::Parse()
   {
      if (_macroString.StartsWith(_T("HM_DROP_COLUMN_OBJECTS")))
      {
         int pos = _macroString.Find(_T(" "));

         String columnSpecifier = _macroString.Mid(pos);

         int separator = columnSpecifier.Find(_T("."));

         String tableName = columnSpecifier.Mid(0, separator);
         String columnName = columnSpecifier.Mid(separator+1);

         tableName.Trim();
         columnName.Trim();

         Macro macro;
         macro.SetType(Macro::DropColumnKeys);
         macro.SetTableName(tableName);
         macro.SetColumnName(columnName);

         return macro;
      }
      else if (_macroString == _T("UPDATE_MESSAGES_SET_FOLDER_INBOX"))
      {
         Macro macro;
         macro.SetType(Macro::SQLCEUPDATE_MESSAGES_SET_FOLDER_INBOX);
         return macro;
      }
      else if (_macroString == _T("UPDATE_FOLDERS_SET_CURRENT_UID"))
      {
         Macro macro;
         macro.SetType(Macro::SQLCEUPDATE_FOLDERS_SET_CURRENT_UID);
         return macro;
      }
      else if (_macroString == _T("UPDATE_FOLDERS_SET_NEW_PARENTFOLDERID_WHERE_ZERO"))
      {
         Macro macro;
         macro.SetType(Macro::SQLCEUPDATE_FOLDERS_SET_NEW_PARENTFOLDERID_WHERE_ZERO);
         
         return macro;
      }
      else if (_macroString == _T("SQLCE_UPDATE_IMAP_HIERARCHY_DELIMITER"))
      {
         Macro macro;
         macro.SetType(Macro::SQLCE_UPDATE_IMAP_HIERARCHY_DELIMITER);

         return macro;
      }
      
      Macro unknownMacro;
      return unknownMacro;
   }
Example #6
0
ECode CResolveInfo::LoadLabel(
    /* [in] */ IPackageManager* pm,
    /* [out] */ ICharSequence** label)
{
    VALIDATE_NOT_NULL(label);
    *label = NULL;

    if (mNonLocalizedLabel != NULL) {
        *label = mNonLocalizedLabel;
        REFCOUNT_ADD(*label);
        return NOERROR;
    }

    if (!mResolvePackageName.IsNull() && mLabelRes != 0) {
        pm->GetText(mResolvePackageName, mLabelRes, NULL, label);
        if (*label != NULL) {
            String str;
            (*label)->ToString(&str);
            *label = NULL;
            return CStringWrapper::New(str.Trim(), label);
        }
    }

    AutoPtr<IComponentInfo> ci = mActivityInfo != NULL
            ? (IComponentInfo*)mActivityInfo.Get() : (IComponentInfo*)mServiceInfo.Get();
    AutoPtr<IApplicationInfo> ai;
    ci->GetApplicationInfo((IApplicationInfo**)&ai);
    if (mLabelRes != 0) {
        String packageName;
        ci->GetPackageName(&packageName);
        pm->GetText(packageName, mLabelRes, ai, label);
        if (*label != NULL) {
            String str;
            (*label)->ToString(&str);
            *label = NULL;
            return CStringWrapper::New(str.Trim(), label);
        }
    }

    AutoPtr<ICharSequence> data;
    ci->LoadLabel(pm, (ICharSequence**)&data);
    // Make the data safe
    if (data != NULL) {
        String str;
        data->ToString(&str);
        CStringWrapper::New(str.Trim(), label);
    }

    return NOERROR;
}
int main(int argc, char ** argv)
{
   CompleteSetupSystem css;

   PrintExampleDescription();

   while(1)
   {
      printf("Please enter a string representing a hostname-colon-port or host-address-colon-port: ");
      fflush(stdout);

      char buf[1024];
      (void) fgets(buf, sizeof(buf), stdin);

      String s = buf;
      s = s.Trim();  // get rid of newline ugliness

      IPAddressAndPort iap(s, 6666, true);
      printf("I parsed the string [%s] as IPAddressAndPort %s\n", s(), iap.ToString()());

      const IPAddress & ip = iap.GetIPAddress();
      printf("    ip.IsValid() returned %i\n", ip.IsValid());
      printf("    ip.IsIPv4() returned %i\n", ip.IsIPv4());
      printf("    ip.IsMulticast() returned %i\n", ip.IsMulticast());
      printf("    ip.IsStandardLoopbackAddress() returned %i\n", ip.IsStandardLoopbackDeviceAddress());
      printf("\n");
   }

   return 0;
}
Example #8
0
static inline String TrimClassName(String clss)
{
	int f = clss.Find('$');
	if(f >= 0)
		clss.Trim(f);
	return clss;
}
Example #9
0
/**
*  @brief
*    Writes the scene node position, rotation, scale, bounding box and flags into a file
*/
void PLSceneNode::WriteToFilePosRotScaleBoxFlags(XmlElement &cNodeElement) const
{
	// Currently ONLY the center of the container the node is in use used to make it relative
	const Point3 vParentWorldSpaceCenter = GetContainer() ? GetContainer()->GetWorldSpaceCenter() : Point3(0.0f, 0.0f, 0.0f);

	// Write down the position
	PLTools::XmlElementSetAttributeWithDefault(cNodeElement, "Position", (GetType() != TypeScene && GetType() != TypeCell) ? m_vPos-vParentWorldSpaceCenter : static_cast<const PLSceneContainer*>(this)->GetWorldSpaceCenter(), Point3(0.0f, 0.0f, 0.0f));

	// Write down the rotation
	PLTools::XmlElementSetAttributeWithDefault(cNodeElement, "Rotation", m_vRot, Point3(0.0f, 0.0f, 0.0f));

	// Write down the scale
	PLTools::XmlElementSetAttributeWithDefault(cNodeElement, "Scale", m_vScale, Point3(1.0f, 1.0f, 1.0f));

	// Are there any flags?
	if (m_sFlags.GetLength()) {
		String sFlags = cNodeElement.GetAttribute("Flags");
		if (sFlags.GetLength())
			sFlags += '|' + m_sFlags;
		else
			sFlags = m_sFlags;
		sFlags.Trim();
		cNodeElement.SetAttribute("Flags", sFlags);
	}
}
ECode HttpURLConnection::GetResponseCode(
    /* [out] */ Int32* responseCode)
{
    VALIDATE_NOT_NULL(responseCode)

    // Call getInputStream() first since getHeaderField() doesn't return
    // exceptions
    AutoPtr<IInputStream> is;
    FAIL_RETURN(GetInputStream((IInputStream**)&is));
    String response;
    GetHeaderField(0, &response);
    if (response.IsNull()) {
        *responseCode = -1;
        return NOERROR;
    }
    response = response.Trim();
    Int32 mark = response.IndexOf(" ") + 1;
    if (mark == 0) {
        *responseCode = -1;
        return NOERROR;
    }
    Int32 last = mark + 3;
    if (last > response.GetLength()) {
        last = response.GetLength();
    }
    mResponseCode = StringUtils::ParseInt32(response.Substring(mark, last));
    if ((last + 1) <= response.GetLength()) {
        mResponseMessage = response.Substring(last + 1);
    }
    *responseCode = mResponseCode;
    return NOERROR;
}
Example #11
0
void __fastcall TFormMain::NMUDP1DataReceived(TComponent *Sender,
      int NumberBytes, AnsiString FromIP, int Port)
{
char * buf = (char*)malloc(5000);
int bytesread = 0;
NMUDP1->ReadBuffer( buf, 5000, bytesread );

char *p = strtok( buf, "\n" );
String proc = p;
proc = proc.Trim();

// procura processo ( a primeira linha da mensagem é o nome do processo )
for ( unsigned i = 0; i < Processos.size(); i++ )
  if ( proc.AnsiCompareIC(Processos[i]) == 0 )
    { // achou, resseta watchdog
    WDCnt[i] = 0;

    if ( i == (unsigned)ProcIndex ) // mostra se for o processo selecionado
      {
      memoMens->Lines->Clear();
      memoMens->Lines->Add( proc );
      while ( ( p = strtok(NULL, "\n")) != NULL )
         {
         memoMens->Lines->Add(p);
         }
      }
    break;
    }

free(buf);
}
Example #12
0
void CProxyProperties::SetExclusionList(
    /* [in] */ const String& exclusionList)
{
    mExclusionList = exclusionList.ToLowerCase();
    if (exclusionList.IsNull()) {
        mParsedExclusionList = ArrayOf<String>::Alloc(0);
    }
    else {
       AutoPtr <ArrayOf<String> >splitExclusionList;
       StringUtils::Split(mExclusionList, String(","), (ArrayOf<String>**)&splitExclusionList);
       Int32 length;
       length = splitExclusionList->GetLength();
       mParsedExclusionList = ArrayOf<String>::Alloc(length* 2);
       for (int i = 0; i < length; i++) {
           String str;
           str = (*splitExclusionList)[i];
           String s = str.Trim();
           if (s.StartWith(".")) {
               s = s.Substring(1);
           }
           String temp = String(".") + s;
           mParsedExclusionList->Set(i*2, s);
           mParsedExclusionList->Set((i*2)+1, temp);
       }
    }
}
Example #13
0
AutoPtr<ITimeZone> TimeZone::GetDefault()
{
    if (sDefaultTimeZone == NULL) {
        AutoPtr<ITimeZoneGetter> tzGetter = TimeZoneGetter::GetInstance();
        String zoneName;
        if (tzGetter != NULL) {
            tzGetter->GetId(&zoneName);
        }
        if (!zoneName.IsNull()) {
            zoneName = zoneName.Trim();
        }
        if (!zoneName.IsNull() || zoneName.IsEmpty()) {
            // try {
                // On the host, we can find the configured timezone here.
            ECode ec = IoUtils::ReadFileAsString(String("/etc/timezone"), &zoneName);
            // } catch (IOException ex) {
                // "vogar --mode device" can end up here.
                // TODO: give libcore access to Android system properties and read "persist.sys.timezone".
            if (FAILED(ec)) {
                zoneName = String("GMT");
            }
            // }
        }
        TimeZone::GetTimeZone(zoneName, (ITimeZone**)&sDefaultTimeZone);
    }

    AutoPtr<ITimeZone> tz;
    sDefaultTimeZone->Clone((ITimeZone**)&tz);
    return tz;
}
Example #14
0
void Navigator::NavGroup(bool local)
{
	for(int i = 0; i < nitem.GetCount(); i++) {
		NavItem& m = nitem[i];
		String g = m.nest;
		if(m.kind == TYPEDEF)
			g.Trim(max(g.ReverseFind("::"), 0));
		if(IsNull(g) || CodeBase().namespaces.Find(m.nest) >= 0) {
			if(g.GetCount()) // We want to show the namespace
				g << '\xff';
			else
				g.Clear();
			g << GetSourceFilePath(m.decl_file);
			g = '\xff' + g;
		}
		if(!local)
			g = (char)(m.pass + 10) + g;
		if(local)
			if(gitem.GetCount() && gitem.TopKey() == g)
				gitem.Top().Add(&m);
			else
				gitem.Add(g).Add(&m);
		else
			gitem.GetAdd(g).Add(&m);
	}
}
void ExtractAlphaChannelsInterface::__ChannelList_EditCompleted( Edit& sender )
{
   try
   {
      String s = sender.Text();
      s.Trim();

      SortedArray<int> list;
      ExtractAlphaChannelsInstance::ParseChannelList( list, s );

      s.Clear();
      for ( size_type i = 0; ; )
      {
         s.Append( String( list[i] ) );
         if ( ++i == list.Length() )
            break;
         s.Append( ',' );
      }

      instance.channelList = s;
      sender.SetText( s );
   }

   ERROR_CLEANUP(
      sender.SetText( instance.channelList );
      sender.SelectAll();
      sender.Focus()
   )
}
Example #16
0
   DateTime
   Utilities::GetDateTimeFromReceivedHeader(const String &sReceivedHeader)
   {
      DateTime dtRetValue;

      int iLastSemicolon = sReceivedHeader.ReverseFind(_T(";"));
      if (iLastSemicolon == -1)
         return dtRetValue;

      String sDatePart = sReceivedHeader.Mid(iLastSemicolon + 1);

      /*
      sFirstPart now contains the following
      received =  "Received"    ":"            ; one per relay
      ["from" domain]           ; sending host
      ["by"   domain]           ; receiving host
      ["via"  atom]             ; physical path
      *("with" atom)             ; link/mail protocol
      ["id"   msg-id]           ; receiver msg id
      ["for"  addr-spec]        ; initial form
      ";"    date-time         ; time received

      http://cr.yp.to/immhf/envelope.html
      In theory, the value of a Received field is tokenizable.
      In practice, SMTP servers put all sorts of badly formatted information into Received lines. 
      Hence: We only do a quick search
      */

      sDatePart.Trim();

      dtRetValue = Time::GetDateTimeFromMimeHeader(sDatePart);
      
      return dtRetValue;
   }
Example #17
0
String TForm3::Format(String s)
{
if (s.Trim()=="") {return s;}
int length=LE->Text.Length();
//1 произвести замены
bool replace=false;
for (int i=1; i<SG->RowCount-1&&!replace; i++)
	{
	String r=Replace(s,SG->Cells[0][i],SG->Cells[1][i]);
	if (s!=r)
		{
		replace=true;
		s=r;
		}
	}
if (replace)
	{
	s=Replace(s,".","");
	s=Replace(s,"-","");
	s=Replace(s,",","");
	s=Replace(s,":","");

		//2 форматировать как на образце
		int k=0;
		for (int i=1; i<=length; i++)
			{
			if (LE->Text.SubString(i,1)!="_")
				{
				s.Insert(LE->Text.SubString(i,1),i+k);
				//k++;
				}
			}
	}
return s.SubString(1,length);
}
/* This little program demonstrates the parsing of IPAddress strings */
int main(int argc, char ** argv)
{
   CompleteSetupSystem css;

   PrintExampleDescription();

   while(1)
   {
      printf("Please enter a string representing an IPv4 or IPv6 numeric host-address: ");
      fflush(stdout);

      char buf[1024];
      (void) fgets(buf, sizeof(buf), stdin);

      String s = buf;
      s = s.Trim();  // get rid of newline ugliness

      IPAddress ip;
      if (ip.SetFromString(s) == B_NO_ERROR)
      {
         printf("I parsed the string [%s] as IPAddress %s\n", s(), ip.ToString()());
         printf("    ip.IsValid() returned %i\n", ip.IsValid());
         printf("    ip.IsIPv4() returned %i\n", ip.IsIPv4());
         printf("    ip.IsMulticast() returned %i\n", ip.IsMulticast());
         printf("    ip.IsStandardLoopbackAddress() returned %i\n", ip.IsStandardLoopbackDeviceAddress());
         printf("\n");
      }
      else printf("Error, couldn't parse [%s] as an IPAddress!\n", s());
   }
   return 0;
}
ECode CActivityOne::Btn3OnClickListener::OnClick(
    /* [in] */ IView* v)
{
    AutoPtr<IEditText> et = IEditText::Probe(mOwner->FindViewById(R::id::et));
    String url;
    AutoPtr<ICharSequence> textCS;
    et->GetText((ICharSequence**)&textCS);
    String text;
    textCS->ToString(&text);
    url = text.Trim();
    AutoPtr<IURLUtil> urlUtil;
    CURLUtil::AcquireSingleton((IURLUtil**)&urlUtil);
    Boolean result = FALSE;
    //if (urlUtil->IsNetworkUrl(url, &result), result){
    if (urlUtil->IsValidUrl(url, &result), result){
        mOwner->wv->LoadUrl(url);
    }
    else {
        AutoPtr<IToastHelper> toastHelper;
        CToastHelper::AcquireSingleton((IToastHelper**)&toastHelper);
        AutoPtr<ICharSequence> tipText;
        CStringWrapper::New(String("sorry, url is Error!"), (ICharSequence**)&tipText);
        AutoPtr<IToast> toast;
        toastHelper->MakeText(mOwner, tipText, IToast::LENGTH_SHORT, (IToast**)&toast);
        toast->Show();
        et->RequestFocus(&result);
    }
    return NOERROR;
}
Example #20
0
//---------------------------------------------------------------------
__fastcall TFormMain::TFormMain(TComponent *Owner)
  : TForm(Owner)
{
ProcIndex = -1;
HIDE = 0;
Caption = "Process Monitor";

TIniFile *Ini = new TIniFile( FILE_INI );
if ( Ini == NULL )
  {
  exit(1);
  }

NMUDP1->LocalPort = Ini->ReadInteger( "CONF", "Port", 8081 );

for ( int i = 1; i < 20; i++ )
  {
  String str;
  String section = "PROC";
  section = section + i;
  str = Ini->ReadString( section, "File", "" );
  // remove as plicas "" e outros caracteres do caminho
  str = str.Trim();
  if ( str != "" )
    {
    Processos.push_back( str ); // caminho completo do executável
    Args.push_back( Ini->ReadString(section, "Args", "") ); // argumentos de linha de comando
    Modo.push_back( Ini->ReadInteger(section, "Mode", 0) ); // modo
    WDCnt.push_back(0); // contagem inicial zerada
    WDCntToRestart.push_back( Ini->ReadInteger(section, "RestartCount", 12) ); // tempo para restart
    }
  }

 HIDE = Ini->ReadInteger( "CONF", "Hide", 0 );
}
Example #21
0
void FontComboBox::SetCurrentFont( const String& face )
{
   String findFace = face;
   findFace.Trim();
   if ( findFace.IsEmpty() )
      findFace = "Default";
   SetCurrentItem( FindItem( ' ' + findFace + ' ', 0, true ) ); // find exact match, case insensitive
}
Example #22
0
String Stream::Get(int size)
{
	StringBuffer b(size);
	int n = Get(~b, size);
	b.SetCount(n);
	String s = b;
	s.Trim(n);
	return s;
}
Example #23
0
void __fastcall TForm9::BitBtn2Click(TObject *Sender)
{
   if(Form38->TBdata=="5")
    {
        ShowMessage("正在同步移库数据");
        return;
    }

   BitBtn1Click(Sender);
   String Dir;
   if(SelectDirectory("Directory Name","",Dir))
   {
         if(Dir.SubString(Dir.Length(),1)!="\\")
         {
                   Dir=Dir+"\\";
         }


      TStringList *SaveList=new TStringList();
      int selectnum=Form1->YK_ADOQuery->RecordCount;
      String str="";
      String FileName="移库表";
      String datetime= Now().FormatString("yyyymmddhhnnss");
      SaveList->Text="";
      for(int i=0;i<selectnum;i++)
      {
             str="";
           //  RK_Grid->Columns->Items[0]->Field->
             str="YK,"+
                 Form1->YK_ADOQuery->FieldByName("条码")->AsString+","+
                 Form1->YK_ADOQuery->FieldByName("名称")->AsString+","+
                 Form1->YK_ADOQuery->FieldByName("货号")->AsString+","+
                 Form1->YK_ADOQuery->FieldByName("规格")->AsString+","+
                 Form1->YK_ADOQuery->FieldByName("型号")->AsString+",";
             if(Form1->Pshow=="show")str+=Form1->YK_ADOQuery->FieldByName("进价")->AsString+",";
             str+=Form1->YK_ADOQuery->FieldByName("售价")->AsString+","+
                 Form1->YK_ADOQuery->FieldByName("单位")->AsString+","+
                 Form1->YK_ADOQuery->FieldByName("备注一")->AsString+","+
                 Form1->YK_ADOQuery->FieldByName("备注二")->AsString+","+
                 Form1->YK_ADOQuery->FieldByName("备注三")->AsString+","+
                 Form1->YK_ADOQuery->FieldByName("原仓库")->AsString+","+
                 Form1->YK_ADOQuery->FieldByName("目的仓库")->AsString+","+
                 Form1->YK_ADOQuery->FieldByName("数量")->AsString+","+
                 Form1->YK_ADOQuery->FieldByName("移库时间")->AsString+","+
                 Form1->YK_ADOQuery->FieldByName("员工编号")->AsString+","+
                 Form1->YK_ADOQuery->FieldByName("员工姓名")->AsString;
             SaveList->Add(str);
             Form1->YK_ADOQuery->Next();
      }
      Form1->SaveExcel(SaveList,Dir.Trim()+FileName+"-"+datetime+".xls") ;
      MessageDlg("导出完成",mtInformation,TMsgDlgButtons()<<mbOK,0);

      delete SaveList;
   }
   else
   return;
}
Example #24
0
//---------------------------------------------------------------------------
void __fastcall TChatClientWindow::WMMessageReceived (TMessage& Message)
{
  String* str = (String*)Message.WParam;
  for (int i = 1; i <= str->Length (); i++)
    if (ACE_OS::ace_isspace ((*str)[i]))
      (*str)[i] = ' ';
  OutputMemo->Lines->Append (str->Trim ());
  delete str;
}
Example #25
0
void FontComboBox::__ItemHighlighted( ComboBox& sender, int index )
{
   if ( onFontHighlighted != 0 )
   {
      String face = (index < 0) ? String() : ItemText( index );
      face.Trim();
      (onFontHighlightedReceiver->*onFontHighlighted)( *this, face );
   }
}
Example #26
0
String __fastcall ASEditDataSetAttachment::getFilePath(String asID){
	String lsPath = "";
	lsPath = fEditorDS->DataSetSvr->Values[fFilePathExp] ;
	if(lsPath.Trim().IsEmpty()) throw Exception("没有制定附件或图片文件名称");
	String lsDir = ExtractFileDir(lsPath);
	if(!DirectoryExists(lsDir))
		if(!ForceDirectories(lsDir)) throw Exception("无法创建数据文件路径"+ lsDir);
	return lsPath;
}
Example #27
0
void BaseSetupDlg::OnUpp()
{
    if(new_base) {
        String s = ~upp;
        int f = s.Find(';');
        if(f >= 0) s.Trim(f);
        base <<= GetFileTitle(s);
    }
}
Example #28
0
String FormatNest(String nest)
{
	int q = nest.Find("@");
	if(q >= 0) {
		nest.Trim(q);
		nest << "[anonymous]";
	}
	return nest;
}
Example #29
0
String FontComboBox::CurrentFontFace() const
{
   int index = CurrentItem();
   if ( index < 0 )
      return String();
   String face = ItemText( index );
   face.Trim();
   return face;
}
Anything GenericXMLParser::ParseComment()
{
	StartTrace(GenericXMLParser.ParseComment);
	int c;
	// keep comments for test cases relying on them
	String comment;
#define GSR ((c = Get()),comment.Append(char(c)))

	c = Get();
	if (c == '-') {
		c = Get();
		if (c == '-') {
			// now we are inside a comment

			// skip whitespace
			for (;;) {
				GSR;
				if (!isspace( (unsigned char) c)) {
					break;
				}
			}
			// skip comment
			for (;;) {
				if (c == EOF || c == 0) {
					break;
				}
				if (c == '-') {
					GSR;
					if (c == '-') {
						GSR;
						while ( c == '-' ) {
							GSR;
						}
						if (c == '>') {
							// end of comment
							break;
						}
					}
				}
				GSR;
			}
			comment.Trim(comment.Length() - 3); // cut -->
			Anything result;
			result["!--"] = comment; // /"!--" marks the comment
			return result;
		}
	}
	String msg("Unexpected character or EOF in Comment: ");
	msg.Append((char)c);
	Error(msg);
	if ('>' != c) {
		comment.Append(SkipToClosingAngleBracket());
	}
	Anything result;
	result["!--"] = comment;
	return result;
}