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


C++ UTF8函数代码示例

本文整理汇总了C++中UTF8函数的典型用法代码示例。如果您正苦于以下问题:C++ UTF8函数的具体用法?C++ UTF8怎么用?C++ UTF8使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: switch

FTSelection *FTDistance::optimize(FTContext *ftcontext, bool execute) const
{
    XPath2MemoryManager *mm = ftcontext->context->getMemoryManager();

    if(execute || range_.arg1->isConstant()) {
        Result rangeResult = range_.arg1->createResult(ftcontext->context);
        Numeric::Ptr num = (Numeric::Ptr)rangeResult->next(ftcontext->context);
        long distance = ::atol(UTF8(num->asString(ftcontext->context)));

        switch(range_.type) {
        case FTRange::EXACTLY: {
            FTSelection *result = new (mm) FTDistanceLiteral(arg_, FTRange::EXACTLY, distance, 0, unit_, mm);
            result->setLocationInfo(this);
            return result->optimize(ftcontext, execute);
        }
        case FTRange::AT_LEAST: {
            FTSelection *result = new (mm) FTDistanceLiteral(arg_, FTRange::AT_LEAST, distance, 0, unit_, mm);
            result->setLocationInfo(this);
            return result->optimize(ftcontext, execute);
        }
        case FTRange::AT_MOST: {
            FTSelection *result = new (mm) FTDistanceLiteral(arg_, FTRange::AT_MOST, distance, 0, unit_, mm);
            result->setLocationInfo(this);
            return result->optimize(ftcontext, execute);
        }
        case FTRange::FROM_TO: {
            Result rangeResult2 = range_.arg2->createResult(ftcontext->context);
            Numeric::Ptr num2 = (Numeric::Ptr)rangeResult2->next(ftcontext->context);
            long distance2 = ::atol(UTF8(num->asString(ftcontext->context)));

            FTSelection *result = new (mm) FTDistanceLiteral(arg_, FTRange::FROM_TO, distance, distance2, unit_, mm);
            result->setLocationInfo(this);
            return result->optimize(ftcontext, execute);
        }
        }
    }

    FTSelection *newarg = arg_->optimize(ftcontext, execute);
    if(newarg == 0) return 0;

    if(newarg->getType() == WORD) {
        return newarg;
    }

    newarg = new (mm) FTDistance(range_, unit_, newarg, mm);
    newarg->setLocationInfo(this);
    return newarg;
}
开发者ID:kanbang,项目名称:Colt,代码行数:48,代码来源:FTDistance.cpp

示例2: EL_THROW_EXCEPTION

	BitSet64 XmlUtil::get_bitset64_value(const xmlNodePtr node)
	{
		if (node == 0)
		{
			EL_THROW_EXCEPTION(InvalidParameterException()
				<< errinfo_message(UTF8("parameter is zero"))
				<< errinfo_parameter_name(UTF8("node")));
		}

		if (node->children == 0)
		{
			return 0;
		}

		return boost::lexical_cast<BitSet64>(node->children->content);
	}
开发者ID:xaphier,项目名称:Eternal-Lands,代码行数:16,代码来源:xmlutil.cpp

示例3: cxJsonLuaMake

static cxInt cxJsonLuaMake(lua_State *L)
{
    cxConstChars json = luaL_checkstring(L, 1);
    cxJson ret = cxJsonCreate(UTF8(json));
    CX_LUA_PUSH_OBJECT(ret);
    return 1;
}
开发者ID:812872970,项目名称:cxEngine,代码行数:7,代码来源:cxJson.c

示例4: RemoveLockingFile

static int
RemoveLockingFile(ConstUnicode lockDir,   // IN:
                  ConstUnicode fileName)  // IN:
{
   int err;
   Unicode path;

   ASSERT(lockDir);
   ASSERT(fileName);

   path = Unicode_Join(lockDir, DIRSEPS, fileName, NULL);

   err = FileDeletionRobust(path, FALSE);

   if (err != 0) {
      if (err == ENOENT) {
         /* Not there anymore; locker unlocked or timed out */
         err = 0;
      } else {
         Warning(LGPFX" %s of '%s' failed: %s\n", __FUNCTION__,
                 UTF8(path), strerror(err));
      }
   }

   Unicode_Free(path);

   return err;
}
开发者ID:dontsueme,项目名称:vmware-view-open-client,代码行数:28,代码来源:fileLockPrimitive.c

示例5: GetContact

static HANDLE GetContact(TCHAR *arg, TCHAR **pemail, CMsnProto *proto)
{
	TCHAR* email = NULL;
	do
	{
		TCHAR *tok = _tcschr(arg, '&'); /* next token */
		if (tok != NULL) *tok++ = '\0';

		if (_tcsnicmp(arg, _T("contact="), 8) == 0)
		{
			arg += 8;
			UrlDecode(arg);
			email = arg;
		}
		arg = tok;
	}
	while(arg != NULL);

	if (email == NULL || email[0] == '\0')
	{
		if (pemail) *pemail = NULL;
		return NULL;
	}
	if (pemail) *pemail = email;
	HANDLE hContact = proto->MSN_HContactFromEmail(UTF8(email), NULL, true, true);
	return hContact;
}
开发者ID:MrtsComputers,项目名称:miranda-ng,代码行数:27,代码来源:msn_links.cpp

示例6: HtmlEncodeUTF8T

// Helper to process texts
static char * HtmlEncodeUTF8T(const TCHAR *src)
{
	if (src == NULL)
		return mir_strdup("");

	return HtmlEncode(UTF8(src));
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:8,代码来源:msn_misc.cpp

示例7: get_strings

	static Vector<String> get_strings (const Vector<Byte> & buffer) {
	
		//	Decode
		auto str=UTF8().Decode(buffer.begin(),buffer.end());
		
		//	Separate on NULL character
		Vector<String> retr;
		for (auto cp : str.CodePoints()) {
		
			if (retr.Count()==0) retr.EmplaceBack();
			
			if (cp=='\0') {
			
				retr.EmplaceBack();
				
				continue;
			
			}
			
			retr[retr.Count()-1] << cp;
		
		}
		
		return retr;
	
	}
开发者ID:HalfDemon,项目名称:MCPP,代码行数:26,代码来源:main.cpp

示例8: main

int main(int argc, char *argv[]) {
  // Initialise Xerces-C and XQilla by creating the factory object
  XQilla xqilla;

  // Parse an XQuery expression
  // (AutoDelete deletes the object at the end of the scope)
  AutoDelete<XQQuery> query(xqilla.parse(X("foo/bar/@baz")));

  // Create a context object
  AutoDelete<DynamicContext> context(query->createDynamicContext());

  // Parse a document, and set it as the context item
  Sequence seq = context->resolveDocument(X("foo.xml"));
  if(!seq.isEmpty() && seq.first()->isNode()) {
    context->setContextItem(seq.first());
    context->setContextPosition(1);
    context->setContextSize(1);
  }

  // Execute the query, using the context
  Result result = query->execute(context);

  // Iterate over the results, printing them
  Item::Ptr item;
  while(item = result->next(context)) {
    std::cout << UTF8(item->asString(context)) << std::endl;
  }

  return 0;
}
开发者ID:kanbang,项目名称:Colt,代码行数:30,代码来源:simple-context-item.cpp

示例9: FileIO_Unlock

FileIOResult
FileIO_Unlock(FileIODescriptor *file)  // IN/OUT:
{
    FileIOResult ret = FILEIO_SUCCESS;

    ASSERT(file);

#if !defined(__FreeBSD__) && !defined(sun)
    if (file->lockToken != NULL) {
        int err = 0;

        if (!FileLock_Unlock(file->lockToken, &err, NULL)) {
            Warning(LGPFX" %s on '%s' failed: %s\n",
                    __FUNCTION__, UTF8(file->fileName), strerror(err));

            ret = FILEIO_ERROR;
        }

        file->lockToken = NULL;
    }
#else
    ASSERT(file->lockToken == NULL);
#endif // !__FreeBSD__ && !sun

    return ret;
}
开发者ID:nf-mlo,项目名称:open-vm-tools,代码行数:26,代码来源:fileIO.c

示例10: _px

void registerViewController::loadDisButton(CCSize _size, int _lineHeight){

	
	CAButton* button1 = CAButton::createWithFrame(CCRect(-1, 10 + _lineHeight, _size.width / 5, _px(50)), CAButtonTypeCustom);
	button1->setAllowsSelected(false);
	CAScale9ImageView* imageView = CAScale9ImageView::createWithImage(CAImage::create("image/bg.png"));
	button1->setBackGroundViewForState(CAControlStateAll, imageView);
	this->getView()->addSubview(button1);

	CAView* view1 = CAView::createWithFrame(CCRect(-1, 11 + _lineHeight, _size.width / 5 - 1, _px(48)));
	view1->setColor(ccc4(220, 220, 220, 250));
	this->getView()->addSubview(view1);

	CALabel* label = CALabel::createWithCenter(view1->getCenter());
	label->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
	label->setTextAlignment(CATextAlignmentCenter);
	label->setFontSize(_px(20));
	if (_lineHeight==0)
	{
		label->setText("+86");
	}
	else{
		label->setText(UTF8("邀请码"));
	}
	this->getView()->addSubview(label);

}
开发者ID:a752602882,项目名称:DotaMax,代码行数:27,代码来源:registerViewController.cpp

示例11: FileIO_Lock

FileIOResult
FileIO_Lock(FileIODescriptor *file,  // IN/OUT:
            int access)              // IN:
{
    FileIOResult ret = FILEIO_SUCCESS;

    /*
     * Lock the file if necessary.
     */

    ASSERT(file);
    ASSERT(file->lockToken == NULL);

    FileIOResolveLockBits(&access);
    ASSERT((access & FILEIO_OPEN_LOCKED) == 0);

#if !defined(__FreeBSD__) && !defined(sun)
    if ((access & FILEIO_OPEN_LOCK_MANDATORY) != 0) {
        /* Mandatory file locks are available only when opening a file */
        ret = FILEIO_LOCK_FAILED;
    } else if ((access & FILEIO_OPEN_LOCK_ADVISORY) != 0) {
        int err = 0;

        file->lockToken = FileLock_Lock(file->fileName,
                                        (access & FILEIO_OPEN_ACCESS_WRITE) == 0,
                                        FILELOCK_DEFAULT_WAIT,
                                        &err,
                                        NULL);

        if (file->lockToken == NULL) {
            /* Describe the lock not acquired situation in detail */
            Warning(LGPFX" %s on '%s' failed: %s\n",
                    __FUNCTION__, UTF8(file->fileName),
                    (err == 0) ? "Lock timed out" : strerror(err));

            /* Return a serious failure status if the locking code did */
            switch (err) {
            case 0:             // File is currently locked
            case EROFS:         // Attempt to lock for write on RO FS
                ret = FILEIO_LOCK_FAILED;
                break;
            case ENAMETOOLONG:  // Path is too long
                ret = FILEIO_FILE_NAME_TOO_LONG;
                break;
            case ENOENT:        // No such file or directory
                ret = FILEIO_FILE_NOT_FOUND;
                break;
            case EACCES:       // Permissions issues
                ret = FILEIO_NO_PERMISSION;
                break;
            default:            // Some sort of locking error
                ret = FILEIO_ERROR;
            }
        }
    }
#endif // !__FreeBSD__ && !sun

    return ret;
}
开发者ID:nf-mlo,项目名称:open-vm-tools,代码行数:59,代码来源:fileIO.c

示例12: Chr8

void JSONObject::generate(Error& error, const HOutputStream& out) const
{
	out->twrite(error, Chr8('{'));

	if (error)
		return;

	if (size() > 0)
	{
		bool bFirst = true;

		TreeMap<UTF16, JSON>::Iterator it(m_core->m_tree);
		UTF16 sKey;
		JSON value;
		while (it(sKey, value))
		{
			if (bFirst)
				bFirst = false;
			else
			{
				out->twrite(error, UTF8(", "));
				if (error)
					return;
			}

			JSON(sKey).generate(error, out);

			if (error)
				return;

			out->twrite(error, UTF8(": "));

			if (error)
				return;

			value.generate(error, out);

			if (error)
				return;
		}
	}
	out->twrite(error, Chr8('}'));

	if (error)
		return;
}
开发者ID:tomazos,项目名称:Folderscope,代码行数:46,代码来源:JSONObject.cpp

示例13: m_exclusive_group

//*****************************************************************************
Kwave::MenuItem::MenuItem(Kwave::MenuNode *parent,
                          const QString &name,
                          const QString &command,
                          const QKeySequence &shortcut,
                          const QString &uid)
    :Kwave::MenuNode(parent, name, command, shortcut, uid),
     m_exclusive_group(), m_action(0)
{
    Q_ASSERT(parent);
    if (!parent) return;

    m_action.setText(i18nc(UTF8(_("menu: ") + path()), UTF8(name)));
    if (!shortcut.isEmpty()) m_action.setShortcut(shortcut);

    connect(&m_action, SIGNAL(triggered(bool)),
	    this, SLOT(actionTriggered(bool)));
}
开发者ID:KDE,项目名称:kwave,代码行数:18,代码来源:MenuItem.cpp

示例14: buf

UTF8 JSON::generate(Error& error) const
{
	Buffer buf(0);
	HOutputStream out = NewObject(MemoryOutputStream, buf);
	generate(error, out);
	out->twrite(error,'\0');
	return UTF8(Blob(buf));
}
开发者ID:tomazos,项目名称:Folderscope,代码行数:8,代码来源:JSON.cpp

示例15: callfunc_selector

bool CATextSelectView::ccTouchBegan(CATouch *pTouch, CAEvent *pEvent)
{
	CCPoint cTouchPoint = this->convertTouchToNodeSpace(pTouch);

	CCRect newRectL = m_pCursorMarkL->getFrame();
	newRectL.InflateRect(8);
	CCRect newRectR = m_pCursorMarkR->getFrame();
	newRectR.InflateRect(8);

	m_iSelViewTouchPos = 0;
	if (newRectL.containsPoint(cTouchPoint))
	{
		m_iSelViewTouchPos = 1;
		return true;
	}

	if (newRectR.containsPoint(cTouchPoint))
	{
		m_iSelViewTouchPos = 2;
		return true;
	}

	CCPoint point = this->convertTouchToNodeSpace(pTouch);

	CCRect ccTextRect = m_pTextViewMask->getFrame();
	if (ccTextRect.containsPoint(point))
	{
		CATextToolBarView *pToolBar = CATextToolBarView::create();
		pToolBar->addButton(UTF8("\u526a\u5207"), this, callfunc_selector(CATextSelectView::ccCutToClipboard));
		pToolBar->addButton(UTF8("\u590d\u5236"), this, callfunc_selector(CATextSelectView::ccCopyToClipboard));
		pToolBar->addButton(UTF8("\u7c98\u8d34"), this, callfunc_selector(CATextSelectView::ccPasteFromClipboard));
		pToolBar->show();
	}
	else
	{
		if (resignFirstResponder())
		{
			hideTextSelView();
		}
		else
		{
			becomeFirstResponder();
		}
	}
	return true;
}
开发者ID:garyyyy,项目名称:CrossApp,代码行数:46,代码来源:CATextEditHelper.cpp


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