const NAString HbaseRangeRows::getText() const { NAString result = HbaseSearchSpec::getText(); result.append("begin_keys"); result.append(beginKeyExclusive_ ? "(excl)" : "(incl)"); result.append(": "); // rowId_ (begin or end) is in this format: // <length><data> ... <length><data> // // a). length is 2-bytes long // b). data is <length> bytes long // c). there are <n> such pairs, where <n> is determined by // the total length of the data and the length of each pair. extractKeyValuePairs(beginRowId_, result); result.append(" "); result.append("end_keys"); result.append(endKeyExclusive_ ? "(excl)" : "(incl)"); result.append(": "); extractKeyValuePairs(endRowId_, result); result.append(" "); return result; }
void FontImporter::handleChar(std::stringstream & stream, FontFace * font) { Glyph glyph; extractKeyValuePairs(stream, [&glyph](const std::string & key, const std::string & value) { std::uint32_t number = stringzeug::fromString<std::uint32_t>(value); if (key == "id") { glyph.setIndex(number); } else if (key == "x") { glyph.setX(number); } else if (key == "y") { glyph.setY(number); } else if (key == "width") { glyph.setWidth(number); } else if (key == "height") { glyph.setHeight(number); } else if (key == "xoffset") { glyph.setXOffset(number); } else if (key == "yoffset") { glyph.setYOffset(number); } else if (key == "xadvance") { glyph.setXAdvance(number); } else if (key == "page") { glyph.setPage(number); } else if (key == "chnl") { glyph.setChannel(number); } }); if (glyph.index() > 0) { font->addGlyph(glyph); } }
const NAString HbaseUniqueRows::getText() const { NAString result = HbaseSearchSpec::getText(); for ( CollIndex i=0; i<rowIds_.entries(); i++ ) { result.append("unique_rows: "); extractKeyValuePairs(rowIds_[i], result); result.append(" "); } return result; }
void FontImporter::handlePage(std::stringstream & stream, FontFace * font, const std::string & filename) { const std::string path = iozeug::FilePath(filename).directoryPath(); extractKeyValuePairs(stream, [this, font, &path](const std::string & key, const std::string & value) { if (key == "file") { std::string filename = stripped(value, { '"', '\r' }); font->setGlyphTexture(m_resourceManager.load<globjects::Texture>(path + "/" + filename)); } else if (key == "id") { // nothing for now } }); }
void FontImporter::handleKerning(std::stringstream & stream, FontFace * font) { std::uint32_t first = 0; std::uint32_t second = 0; int amount = 0; extractKeyValuePairs(stream, [this, font, &first, &second, &amount](const std::string & key, const std::string & value) { if (key == "first") { first = stringzeug::fromString<std::uint32_t>(value); } else if (key == "second") { second = stringzeug::fromString<std::uint32_t>(value); } else if (key == "amount") { // nothing for now amount = stringzeug::fromString<int>(value); } }); }
void FontImporter::handleCommon(std::stringstream & stream, FontFace * font) { extractKeyValuePairs(stream, [font](const std::string & key, const std::string & value) { font->setConfiguration(key, value); }); }