当前位置: 首页>>代码示例>>C++>>正文


C++ FXString::empty方法代码示例

本文整理汇总了C++中FXString::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ FXString::empty方法的具体用法?C++ FXString::empty怎么用?C++ FXString::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FXString的用法示例。


在下文中一共展示了FXString::empty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FixupShortcuts

/*
  Fox doesn't automatically handle MS-Windows shortcut files, so...
  Iterate through each filename in the file dialog's getFilenames() list,
  if any of them are shortcut (*.lnk) files, dereference the link and
  make the string point to the "real" disk file. If we have multiple files,
  remove any links that point to a directory. But if we only have one string
  in the list, and the string is a link pointing to a directory, we will
  dereference it so the dialog can change into that folder.
*/
static void FixupShortcuts(FXWindow*w, FXString* filenames)
{
  if (!filenames) return;
  FXString* fn;
  FXString* tail=filenames;
  FXuint count=0;
  for (fn=filenames; !fn->empty(); fn++) {
    if (IsLinkExt(*fn)) {
      char*tmp=NULL;
      if (ReadShortcut(&tmp, fn->text())) {
        *fn=tmp;
      } else {
        FXMessageBox::error(w,MBOX_OK,_("Error in shortcut"),"%s\n%s",fn->text(),tmp);
      }
      free(tmp);
    }
    tail=fn;
    count++;
  }
  if (count>1) {
    for (fn=filenames; !fn->empty(); fn++) {
      if (FXStat::isDirectory(*fn)) {
        *fn=tail->text();
        *tail="";
        tail--;
      }
    }
  }
}
开发者ID:gahr,项目名称:fxite,代码行数:38,代码来源:filedlg.cpp

示例2: if

long
MembersFrame::onApplyChanges(FXObject*,FXSelector,void*)
{
  FXFoldingItem *mitem = memberslist->findItemByData((void*)editedmember);
  FXString newname = nametf->getText();
  FXString newlogin = logintf->getText();

  if (mitem) {
    newname.trim();
    newlogin.trim();
    CCL_member_tarif_set(editedmember,tarifset);
    if (!newname.empty() && -1 == CCL_member_find(newname.text()))
      CCL_member_name_set(editedmember,nametf->getText().text());
    CCL_member_email_set(editedmember,emailtf->getText().text());
    CCL_member_other_set(editedmember,phonetf->getText().text());
    if (newlogin.empty() && CCL_data_key_exists(CCL_DATA_MEMBER,editedmember,
						"login_name"))
      CCL_data_key_delete(CCL_DATA_MEMBER,editedmember,"login_name");
    else if (-1 == CCL_data_find_by_key_sval(CCL_DATA_MEMBER,"login_name",
					     newlogin.text()))
      CCL_data_set_string(CCL_DATA_MEMBER,editedmember,"login_name",
			  newlogin.text());
    mitem->setText(FXStringVal((FXint)editedmember) + "\t" + CCL_member_name_get(editedmember));
    memberslist->updateItem(mitem);
  }
#ifdef DEBUG
  printf("onApplyChanges(): Apply Changes Button was pressed\n");
#endif
  
  return 1;
}
开发者ID:rbemmanuel,项目名称:kwama,代码行数:31,代码来源:MembersFrame.cpp

示例3: getUserDirectory

// Get home directory for a given user
FXString FXSystem::getUserDirectory(const FXString& user){
#ifndef WIN32
#if defined(FOX_THREAD_SAFE) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
  struct passwd pwdresult,*pwd;
  char buffer[1024];
  if(user.empty()){
    register const FXchar* str;
    if((str=getenv("HOME"))!=NULL) return str;
    if((str=getenv("USER"))!=NULL || (str=getenv("LOGNAME"))!=NULL){
      if(getpwnam_r(str,&pwdresult,buffer,sizeof(buffer),&pwd)==0 && pwd) return pwd->pw_dir;
      }
    if(getpwuid_r(getuid(),&pwdresult,buffer,sizeof(buffer),&pwd)==0 && pwd) return pwd->pw_dir;
    return PATHSEPSTRING;
    }
  if(getpwnam_r(user.text(),&pwdresult,buffer,sizeof(buffer),&pwd)==0 && pwd) return pwd->pw_dir;
  return PATHSEPSTRING;
#else
  register struct passwd *pwd;
  if(user.empty()){
    register const FXchar* str;
    if((str=getenv("HOME"))!=NULL) return str;
    if((str=getenv("USER"))!=NULL || (str=getenv("LOGNAME"))!=NULL){
      if((pwd=getpwnam(str))!=NULL) return pwd->pw_dir;
      }
    if((pwd=getpwuid(getuid()))!=NULL) return pwd->pw_dir;
    return PATHSEPSTRING;
    }
  if((pwd=getpwnam(user.text()))!=NULL) return pwd->pw_dir;
  return PATHSEPSTRING;
#endif
#else
  if(user.empty()){
    register const FXchar *str1,*str2;
    FXchar home[MAXPATHLEN];
    DWORD size=MAXPATHLEN;
    HKEY hKey;
    LONG result;
    if((str1=getenv("USERPROFILE"))!=NULL) return str1; // Daniël Hörchner <[email protected]>
    if((str1=getenv("HOME"))!=NULL) return str1;
    if((str2=getenv("HOMEPATH"))!=NULL){      // This should be good for WinNT, Win2K according to MSDN
      if((str1=getenv("HOMEDRIVE"))==NULL) str1="c:";
      strncpy(home,str1,MAXPATHLEN);
      strncat(home,str2,MAXPATHLEN);
      return home;
      }
//  FXchar buffer[MAX_PATH]
//  if(SHGetFolderPath(NULL,CSIDL_PERSONAL|CSIDL_FLAG_CREATE,NULL,O,buffer)==S_OK){
//    return buffer;
//    }
    if(RegOpenKeyExA(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",0,KEY_READ,&hKey)==ERROR_SUCCESS){
      result=RegQueryValueExA(hKey,"Personal",NULL,NULL,(LPBYTE)home,&size);  // Change "Personal" to "Desktop" if you want...
      RegCloseKey(hKey);
      if(result==ERROR_SUCCESS) return home;
      }
    return "c:" PATHSEPSTRING;
    }
  return "c:" PATHSEPSTRING;
#endif
  }
开发者ID:Tetimaru,项目名称:LLSIF-Helper,代码行数:60,代码来源:FXSystem.cpp

示例4: open

// Open directory to path, return true if ok.
FXbool FXDir::open(const FXString& path){
  if(!path.empty()){
#ifdef WIN32
#ifdef UNICODE
    FXnchar buffer[MAXPATHLEN];
    utf2ncs(buffer,MAXPATHLEN,path.text(),path.length()+1);
    wcsncat(buffer,TEXT("\\*"),MAXPATHLEN);
#else
    FXchar buffer[MAXPATHLEN];
    strncpy(buffer,path.text(),MAXPATHLEN);
    strncat(buffer,"\\*",MAXPATHLEN);
#endif
    ((SPACE*)space)->handle=FindFirstFile(buffer,&((SPACE*)space)->result);
    if(((SPACE*)space)->handle!=INVALID_HANDLE_VALUE){
      ((SPACE*)space)->first=true;
      return true;
      }
#else
    ((SPACE*)space)->handle=opendir(path.text());
    if(((SPACE*)space)->handle!=NULL){
      return true;
      }
#endif
    }
  return false;
  }
开发者ID:tws67,项目名称:bayonne-base-windows,代码行数:27,代码来源:FXDir.cpp

示例5: ReadClasses

// Run ctags in each source directory
void TagParserBase::ReadClasses()
{
  CmdIO cmdio(mainwin);
  CmdStr cmd=CtagsCmd();
  FXString currdir=FXSystem::getCurrentDirectory();
  FXRex rx("\\.(c|cc|cpp|cxx|h|hh|hpp|hxx)$",FXRex::IgnoreCase);
  for (FXint i=0; i<DirList().no(); i++) {
    const FXString dir=DirList().at(i)->dirname();
    if (dir.empty()) { continue; }
    if (FXSystem::setCurrentDirectory(dir)) {
      FXDir de(dir);
      if (de.isOpen()) {
        FXString fn;
        while (de.next(fn)) {
          if (FXStat::isFile(fn) && (rx.search(fn,0,fn.length())>=0)) { cmd+=fn.text(); }
        }
        de.close();
        current_filename=FXString::null;
        cmdio.setUserData((void*)(FXival)i);
        cmdio.lines(cmd.text(),this,ID_READ_ALL_FILES_LINES);
      }
    }
  }
  FXSystem::setCurrentDirectory(currdir);
}
开发者ID:yetanothergeek,项目名称:fxcodeview,代码行数:26,代码来源:taggerbase.cpp

示例6: GetFilenameAtCursor

// Try to find a filename at the current position in the document.
static bool GetFilenameAtCursor(SciDoc*sci, FXString &filename)
{
  long max=sci->GetTextLength();
  if (max<=0) { return false; }
  TextRange range;
  memset(&range,0,sizeof(range));
  range.chrg.cpMin=sci->GetCaretPos();
  if ( (range.chrg.cpMin>0) && (sci->CharAt(range.chrg.cpMin)<='*') && (sci->CharAt(range.chrg.cpMin-1)>'*') ) {
    // Caret is at the end of a phrase, back up one before looking for start...
    range.chrg.cpMin--;
  }
  // Read backwards till we find the start of our phrase...
  while ( (range.chrg.cpMin>0) && (sci->CharAt(range.chrg.cpMin)>'*') ) { range.chrg.cpMin--; }
  if ( (range.chrg.cpMin<max) && (sci->CharAt(range.chrg.cpMin)<='*') ) { range.chrg.cpMin++; }
  if (range.chrg.cpMin>=max) { return false; }
  range.chrg.cpMax=range.chrg.cpMin+1;
  // Now read forward, looking for the end of our phrase...
  while ( (range.chrg.cpMax<max) && (sci->CharAt(range.chrg.cpMax)>'*') ) { range.chrg.cpMax++; }
  long len=range.chrg.cpMax-range.chrg.cpMin;
  if (len<=0) { return false; }
  range.lpstrText=(char*)calloc(len+1,1);
  sci->sendMessage(SCI_GETTEXTRANGE,0,reinterpret_cast<sptr_t>(&range));
  filename=range.lpstrText;
  free(range.lpstrText);
  return filename.empty()?false:true;
}
开发者ID:gahr,项目名称:fxite,代码行数:27,代码来源:scidoc_util.cpp

示例7: ctrl_open_input

void InputThread::ctrl_open_input(const FXString & uri) {
  GM_DEBUG_PRINT("[input] ctrl_open_input %s\n",uri.text());

  if (uri.empty()) {
    goto failed;
    }

  /// Open Input
  input=open_input(uri);
  if (input==NULL) {
    engine->post(new ErrorMessage(FXString::value("Unable to open %s",uri.text())));
    goto failed;
    }

  reader = open_reader();
  if (reader==NULL) {
    engine->post(new ErrorMessage(FXString::value("No input plugin available for %s",uri.text())));
    goto failed;
    }

  if (!reader->init(input)) {
    engine->post(new ErrorMessage(FXString::value("Failed to initialize plugin")));
    goto failed;
    }

  streamid++;
  set_state(StateProcessing,true);
  return;
failed:
  ctrl_close_input();
  set_state(StateIdle,true);
  }
开发者ID:AenBleidd,项目名称:gogglesmm,代码行数:32,代码来源:ap_input_thread.cpp

示例8: init

void GMSourceView::init() {
  loadSettings("window");
  clear();
  listsources();


  FXString key = getApp()->reg().readStringEntry("window","source-list-current","");
  if (!key.empty()){
    FXTreeItem * item = sourcelist->getFirstItem();
    while(item){
      GMSource * src = static_cast<GMSource*>(item->getData());
      if (src->settingKey()==key) {
        sourcelist->setCurrentItem(item);
        break;
        }
      item=item->getBelow();
      }
    }

  if (sourcelist->getCurrentItem()==nullptr && sourcelist->getFirstItem())
    sourcelist->setCurrentItem(sourcelist->getFirstItem());

  source=static_cast<GMSource*>(sourcelist->getItemData(sourcelist->getCurrentItem()));
  GMPlayerManager::instance()->getTrackView()->init(source);
  }
开发者ID:gogglesmm,项目名称:gogglesmm,代码行数:25,代码来源:GMSourceView.cpp

示例9: findFileBinding

 FXFileAssoc* findFileBinding(const FXString& pathname){
   FXString ext = FXPath::extension(pathname);
   if (!ext.empty()) {
     FXFileAssoc * record = NULL;
     if ((record = bindings[ext])!=NULL) return record;
     if ((record = bindings[ext.lower()])!=NULL) return record;
     }
   return bindings[defaultFileBinding];
   }
开发者ID:sophom,项目名称:gogglesmm,代码行数:9,代码来源:GMImportDialog.cpp

示例10: insertArtist

FXint GMDBTracks::insertArtist(const FXString & artist){
  FXint id=0;
  if (!artist.empty()) {
    query_artist.execute(artist,id);
    if (id==0) {
      id = insert_artist.insert(artist);
      }
    }
  return id;
  }
开发者ID:sophom,项目名称:gogglesmm,代码行数:10,代码来源:GMScanner.cpp

示例11:

/** Control the entered values before adding the server
  *
  * The most important error must be tested last because the error message
  * stored in the errorMsg variable will be overriden.
  *
  * \return \c true if the server can be added
  *
  */
bool RainbruRPG::Gui::AddServer::controls(){
  bool ret=true;
  FXString serverName = tfServerName->getText();
  FXString serverIp   = tfServerIp->getText();

  // Tests the server IP adress
  if(serverIp.empty()){
    errorMsg="The server's IP address cannot be empty";
    ret=false;
  }

  // Tests the server name
  if(serverName.empty()){
    errorMsg="The server's name cannot be empty";
    ret=false;
  }

  return ret;
}
开发者ID:dreamsxin,项目名称:rainbrurpg,代码行数:27,代码来源:addserver.cpp

示例12: setCurrentDrive

// Change current drive prefix "a:"
// This is the same method as used in VC++ CRT.
FXbool FXSystem::setCurrentDrive(const FXString& prefix){
  FXchar buffer[3];
  if(!prefix.empty() && Ascii::isLetter(prefix[0]) && prefix[1]==':'){
    buffer[0]=prefix[0];
    buffer[1]=':';
    buffer[2]='\0';
    return SetCurrentDirectoryA(buffer);
    }
  return FALSE;
  }
开发者ID:Tetimaru,项目名称:LLSIF-Helper,代码行数:12,代码来源:FXSystem.cpp

示例13: setEnvironment

// Change value of environment variable name
bool FXSystem::setEnvironment(const FXString& name,const FXString& value){
  if(!name.empty()){
#ifndef WIN32
#ifdef __GNU_LIBRARY__
    if(!value.empty()){
      return setenv(name.text(),value.text(),TRUE)==0;
      }
    unsetenv(name.text());
    return true;
#endif
#else
    if(!value.empty()){
      return SetEnvironmentVariableA(name.text(),value.text())!=0;
      }
    return SetEnvironmentVariableA(name.text(),NULL)!=0;
#endif
    }
  return false;
  }
开发者ID:Tetimaru,项目名称:LLSIF-Helper,代码行数:20,代码来源:FXSystem.cpp

示例14: createDirectories

// Create a directories recursively
FXbool FXDir::createDirectories(const FXString& path,FXuint perm){
  FXTRACE((1,"path=%s\n",path.text()));
  if(!path.empty()){
    if(FXStat::isDirectory(path)) return true;
    if(createDirectories(FXPath::upLevel(path),perm)){
      if(FXDir::create(path,perm)) return true;
      }
    }
  return false;
  }
开发者ID:tws67,项目名称:bayonne-base-windows,代码行数:11,代码来源:FXDir.cpp

示例15: getEnvironment

// Return value of environment variable name
FXString FXSystem::getEnvironment(const FXString& name){
  if(!name.empty()){
#ifndef WIN32
    return FXString(getenv(name.text()));
#else
    FXchar value[1024];
    DWORD len=GetEnvironmentVariableA(name.text(),value,1024);
    return FXString(value,len);
#endif
    }
  return FXString::null;
  }
开发者ID:Tetimaru,项目名称:LLSIF-Helper,代码行数:13,代码来源:FXSystem.cpp


注:本文中的FXString::empty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。