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


C++ VString::length方法代码示例

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


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

示例1: _lastNonTrailingIndexOfPathSeparator

static int _lastNonTrailingIndexOfPathSeparator(const VString& s, int& lengthWithoutTrailingSeparator) {
    bool hasTrailingPathSeparator = s.endsWith(VFSNode::PATH_SEPARATOR_CHAR);
    if (!hasTrailingPathSeparator) {
        lengthWithoutTrailingSeparator = s.length();
        return s.lastIndexOf(VFSNode::PATH_SEPARATOR_CHAR);
    }

    VString stripped;
    s.getSubstring(stripped, s.begin(), s.end() - 1);
    lengthWithoutTrailingSeparator = stripped.length();
    return stripped.lastIndexOf(VFSNode::PATH_SEPARATOR_CHAR);
}
开发者ID:trygve-isaacson,项目名称:code-vault,代码行数:12,代码来源:vfsnode.cpp

示例2: printBinaryHll

void printBinaryHll(ServerInterface& srvInterface, const char* prefix, const VString& hll) {
  return;
  unsigned int i;
  char buf_str[10000];
  char* buf_ptr = buf_str;

  if (!hll.isNull()) {
      for (i = 0; i < hll.length(); i++)
      {
          buf_ptr += sprintf(buf_ptr, "%02X ", hll.data()[i]);
      }
  }

  *(buf_ptr + 1) = '\0';
  srvInterface.log("%s: %d %s", prefix, hll.length(), buf_str);
}
开发者ID:amirtuval,项目名称:vertica-hyperloglog,代码行数:16,代码来源:Base.cpp

示例3: extractFileName

	bool VDirAdapter::extractFileName(const VString &strFilePath, VString &strName, VString &strTitle) const
	{
		bool bResult = false;
		size_t nLength = strFilePath.length();

		strName = strFilePath;

		size_t nPos = strName.rfind(".");
		size_t nCount = nPos;
		size_t nOffset = 0;
		if (nPos == 0)
			strTitle = "";
		else
			strTitle = strFilePath.substr(nOffset, nCount);

		m_bExtractName = true;

		return bResult;
	}
开发者ID:asnwerear,项目名称:Demo,代码行数:19,代码来源:VDirAdapter.cpp

示例4: findFile

	bool VDirAdapter::findFile(const VString &strPath)
	{
		if (strPath.empty() || strPath == "")
			return false;

#ifdef UNICODE
		WCHAR wszPath[512] = {0};
		::MultiByteToWideChar(CP_UTF8, 0, strPath.c_str(), strPath.length(), wszPath, sizeof(wszPath));
		m_hFindFile = ::FindFirstFile(wszPath, &m_FindFileData);
#else
		m_hFindFile = ::FindFirstFile(strPath.c_str(), &m_FindFileData);
#endif
		
		extractRoot(strPath, m_strRoot);

		m_bExtractName = false;

		return (m_hFindFile != INVALID_HANDLE_VALUE);
	}
开发者ID:asnwerear,项目名称:Demo,代码行数:19,代码来源:VDirAdapter.cpp

示例5: extractExt

 bool VDirAdapter_Unix::extractExt(const VString &strName, VString &strExt)
 {
     bool bResult = false;
     
     size_t nPos = strName.rfind(".");
     
     if (nPos != -1)
     {
         bResult = true;
         size_t nLength = strName.length();
         size_t nCount = nLength - nPos - 1;
         size_t nOffset = nPos + 1;
         strExt = strName.substr(nOffset, nCount);
     }
     else
     {
         bResult = false;
     }
     
     return bResult;
 }
开发者ID:asnwerear,项目名称:Demo,代码行数:21,代码来源:VDirAdapter_Unix.cpp

示例6: VRangeException

VCodePoint::VCodePoint(const VString& hexNotation)
    : mIntValue(0)
    , mUTF8Length(0)
    , mUTF16Length(0)
    {
    // If the string starts with "U+" we skip it.
    // From there we assume the rest is hexadecimal, at most 8 digits.
    int length = hexNotation.length();
    int start = 0;
    if (hexNotation.startsWith("U+")) {
        start += 2;
    }
    
    if (length - start > 8) {
        throw VRangeException(VSTRING_FORMAT("VCodePoint: attempt to construct with invalid notation '%s'.", hexNotation.chars()));
    }
    
    // Walk backwards until we process all characters or see the '+'.
    
    int valueByteIndex = 0;
    for (VString::const_reverse_iterator ri = hexNotation.rbegin(); ri != hexNotation.rend(); /*incremented below*/) {
    //for (int index = length-1; index >= start; ) {
        VCodePoint nextChar = *ri;
        ++ri;

        if (nextChar == '+') {
            break;
        }

        VCodePoint lowNibbleChar = nextChar;
        VCodePoint highNibbleChar('0');

        if (ri != hexNotation.rend()) {
            nextChar = *ri;
            ++ri;

            if (nextChar != '+') {
                highNibbleChar = nextChar;
            }
        }

        if (!highNibbleChar.isHexadecimal() || !lowNibbleChar.isHexadecimal()) {
            throw VRangeException(VSTRING_FORMAT("VCodePoint: attempt to construct with invalid notation '%s'.", hexNotation.chars()));
        }
        
        // At this point we have the two hex chars. Convert to a byte, and or it into the result at the appropriate location.
        Vs32 byteValue = (Vs32) VHex::hexCharsToByte((char) highNibbleChar.intValue(), (char) lowNibbleChar.intValue()); // char TODO: VHex API update to VCodePoint
        byteValue <<= (valueByteIndex * 8);
        Vs32 mask = 0x000000FF << (valueByteIndex * 8);
        
        mIntValue |= (int) (byteValue & mask);
        
        ++valueByteIndex;

        if (nextChar == '+') {
            break;
        }
    }

    mUTF8Length = VCodePoint::getUTF8LengthFromCodePointValue(mIntValue);
    mUTF16Length = VCodePoint::getUTF16LengthFromCodePointValue(mIntValue);
}
开发者ID:JohnChristman,项目名称:code-vault,代码行数:62,代码来源:vcodepoint.cpp

示例7: addItemToHll

void addItemToHll(void* hll, const VString& item) {
    SerializedHyperLogLog* phll = (SerializedHyperLogLog*)hll;
    phll->add(item.data(), item.length());
}
开发者ID:amirtuval,项目名称:vertica-hyperloglog,代码行数:4,代码来源:Base.cpp

示例8: addItem

void SimpleHllAggregateFunctionBase::addItem(ServerInterface &srvInterface, void* hll, const VString& item) {
    HllHolder* phll = (HllHolder*)hll;
    if (phll->hll == NULL)
        phll->hll = (SerializedHyperLogLog*)createNewHll();
    phll->hll->add(item.data(), item.length());
}
开发者ID:amirtuval,项目名称:vertica-hyperloglog,代码行数:6,代码来源:Base.cpp


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