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


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

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


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

示例1: next

// Go to next directory entry and return its name
FXbool FXDir::next(FXString& name){
  if(isOpen()){
#ifdef WIN32
    if(((SPACE*)space)->first || FindNextFile(((SPACE*)space)->handle,&((SPACE*)space)->result)){
      ((SPACE*)space)->first=false;
      name.assign(((SPACE*)space)->result.cFileName);
      return true;
      }
#else
#if defined(FOX_THREAD_SAFE) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
    if(!readdir_r(((SPACE*)space)->handle,&((SPACE*)space)->result,&((SPACE*)space)->dp) && ((SPACE*)space)->dp){
      name.assign(((SPACE*)space)->dp->d_name);
      return true;
      }
#else
    if((((SPACE*)space)->dp=readdir(((SPACE*)space)->handle))!=NULL){
      name.assign(((SPACE*)space)->dp->d_name);
      return true;
      }
#endif
#endif
    }
  name.clear();
  return false;
  }
开发者ID:tws67,项目名称:bayonne-base-windows,代码行数:26,代码来源:FXDir.cpp

示例2: onClipboardRequest

// Somebody wants our clipped text
long TextLabel::onClipboardRequest(FXObject* sender,FXSelector sel,void* ptr)
{
    FXEvent *event=(FXEvent*)ptr;
    FXString string;

    // Perhaps the target wants to supply its own data for the clipboard
    if (FXFrame::onClipboardRequest(sender,sel,ptr))
    	return 1;

    // Recognize the request?
    if (event->target==stringType || event->target==textType || event->target==utf8Type || event->target==utf16Type)
    {

        // Get clipped string
        string=clipped;

        // If password mode, replace by stars
        if (options&TEXTFIELD_PASSWD)
        	string.assign('*',string.count());

        // Return clipped text as as UTF-8
        if (event->target==utf8Type)
        {
            setDNDData(FROM_CLIPBOARD,event->target,string);
            return 1;
        }

        // Return clipped text translated to 8859-1
        if (event->target==stringType || event->target==textType)
        {
            FX88591Codec ascii;
            setDNDData(FROM_CLIPBOARD,event->target,ascii.utf2mb(string));
            return 1;
        }

        // Return text of the selection translated to UTF-16
        if (event->target==utf16Type)
        {
            FXUTF16LECodec unicode;             // FIXME maybe other endianness for unix
            setDNDData(FROM_CLIPBOARD,event->target,unicode.utf2mb(string));
            return 1;
        }
    }
    return 0;
}
开发者ID:tindzk,项目名称:Xfe,代码行数:46,代码来源:TextLabel.cpp

示例3: GetFilenameFromSelection

// Check for an already-selected filename
static void GetFilenameFromSelection(FXMainWindow*tw,SciDoc*sci, FXString &filename)
{
#ifdef WIN32
  sci->GetSelText(filename);
#else // On X11 platforms, try first to get a filename from the X-Selection
  FXuchar*xsel=NULL;
  FXuint xlen=0;
  FXDragType types[] = { tw->textType, tw->utf8Type, tw->stringType, 0 };
  for ( FXDragType*type=types; *type; type++ ) {
    if (tw->getDNDData(FROM_SELECTION,*type, xsel, xlen) && xsel && *xsel) {
      FXuchar*eol=(FXuchar*)memchr(xsel,'\n', xlen);
      FXuint n = eol ? (eol-xsel) : xlen;
      filename.assign((FXchar*)xsel,n);
      filename=filename.simplify();
      if (!FXStat::exists(filename.contains(':')?filename.section(':',0):filename)) {
        filename=FXString::null;
      }
      break;
    }
    if ( filename.empty() ) { sci->GetSelText(filename); }
  }
#endif
}
开发者ID:gahr,项目名称:fxite,代码行数:24,代码来源:scidoc_util.cpp

示例4: onSelectionRequest

// Somebody wants our selection; the text field will furnish it if the target doesn't
long TextLabel::onSelectionRequest(FXObject* sender,FXSelector sel,void* ptr)
{
    FXEvent *event=(FXEvent*)ptr;
    FXString string;
    FXuint   start;
    FXuint   len;

    // Make sure
    FXASSERT(0<=anchor && anchor<=contents.length());
    FXASSERT(0<=cursor && cursor<=contents.length());

    // Perhaps the target wants to supply its own data for the selection
    if (FXFrame::onSelectionRequest(sender,sel,ptr))
    	return 1;

    // Recognize the request?
    if (event->target==stringType || event->target==textType || event->target==utf8Type || event->target==utf16Type)
    {

        // Figure selected bytes
        if (anchor<cursor)
        {
            start=anchor;
            len=cursor-anchor;
        }
        else
        {
            start=cursor;
            len=anchor-cursor;
        }

        // Get selected fragment
        string=contents.mid(start,len);

        // If password mode, replace by stars
        if (options&TEXTFIELD_PASSWD)
        	string.assign('*',string.count());

        // Return text of the selection as UTF-8
        if (event->target==utf8Type)
        {
            setDNDData(FROM_SELECTION,event->target,string);
            return 1;
        }

        // Return text of the selection translated to 8859-1
        if (event->target==stringType || event->target==textType)
        {
            FX88591Codec ascii;
            setDNDData(FROM_SELECTION,event->target,ascii.utf2mb(string));
            return 1;
        }

        // Return text of the selection translated to UTF-16
        if (event->target==utf16Type)
        {
            FXUTF16LECodec unicode;           // FIXME maybe other endianness for unix
            setDNDData(FROM_SELECTION,event->target,unicode.utf2mb(string));
            return 1;
        }
    }
    return 0;
}
开发者ID:tindzk,项目名称:Xfe,代码行数:64,代码来源:TextLabel.cpp


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