本文整理汇总了C++中encoding函数的典型用法代码示例。如果您正苦于以下问题:C++ encoding函数的具体用法?C++ encoding怎么用?C++ encoding使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了encoding函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QgsDebugMsg
QStringList QgsOpenVectorLayerDialog::openFile()
{
QStringList selectedFiles;
QgsDebugMsg( "Vector file filters: " + mVectorFileFilter );
QString enc = encoding();
QString title = tr( "Open an OGR Supported Vector Layer" );
QgisGui::openFilesRememberingFilter( "lastVectorFileFilter", mVectorFileFilter, selectedFiles, enc,
title );
return selectedFiles;
}
示例2: Encoding
void Encoding ( hit *i )
{
Z32 j;
for ( j = 0; j < FIELDS; j++ )
{
word_length = lens[j];
word_code = i->i[j] + negs[j];
encoding();
}
}
示例3: encoding
TextDecoder* TextDecoder::create(const String& label, const TextDecoderOptions& options, ExceptionState& exceptionState)
{
WTF::TextEncoding encoding(label);
// The replacement encoding is not valid, but the Encoding API also
// rejects aliases of the replacement encoding.
if (!encoding.isValid() || !strcasecmp(encoding.name(), "replacement")) {
exceptionState.throwRangeError("The encoding label provided ('" + label + "') is invalid.");
return 0;
}
return new TextDecoder(encoding, options.fatal(), options.ignoreBOM());
}
示例4: is_valid
const char* PredicateRegisterImpl::name() const {
const char* names[number_of_registers] = {
"pr0", "pr1", "pr2", "pr3", "pr4", "pr5", "pr6", "pr7",
"pr8", "pr9", "pr10", "pr11", "pr12", "pr13", "pr14", "pr15",
"pr16", "pr17", "pr18", "pr19", "pr20", "pr21", "pr22", "pr23",
"pr24", "pr25", "pr26", "pr27", "pr28", "pr29", "pr30", "pr31",
"pr32", "pr33", "pr34", "pr35", "pr36", "pr37", "pr38", "pr39",
"pr40", "pr41", "pr42", "pr43", "pr44", "pr45", "pr46", "pr47",
"pr48", "pr49", "pr50", "pr51", "pr52", "pr53", "pr54", "pr55",
"pr56", "pr57", "pr58", "pr59", "pr60", "pr61", "pr62", "pr63"
};
return is_valid() ? names[encoding()] : "noreg";
}
示例5: encoding
HRESULT CPersistMemoryHelper2::Load(BLOB* pblob)
// Load from the indicated blob
{
OSSBUF encoding(World(), OSSBUF::keep);
encoding.length = pblob->cbSize;
encoding.value = pblob->pBlobData;
HRESULT hr = Load(encoding);
if (hr == S_OK)
m_isDirty = FALSE;
return hr;
}
示例6: inf_text_buffer_insert_text
void TextBuffer::insertText( unsigned int pos,
const QByteArray &data,
unsigned int length,
User *user )
{
inf_text_buffer_insert_text( INF_TEXT_BUFFER(gobject()),
pos, data.data(), data.length(), length,
INF_USER(user->gobject()) );
// TODO test me, I don't think this is used anywhere in kobby
QInfinity::TextChunk chunk( encoding() );
chunk.insertText( 0, data, data.length(), user->id() );
inf_text_buffer_text_inserted( INF_TEXT_BUFFER(gobject()),
pos, chunk.infChunk(), INF_USER(user->gobject()) );
}
示例7: encoding
void encoding(T state, Encoding* obj) {
if(obj->nil_p() || (!CBOOL(ascii_only()) && obj->ascii_compatible())) {
ascii_only(cNil);
num_chars(nil<Fixnum>());
valid_encoding(cNil);
}
if(byte_size() == 0 && !obj->nil_p() && obj->ascii_compatible()) {
ascii_only(cTrue);
num_chars(Fixnum::from(0));
valid_encoding(cTrue);
}
encoding(obj);
state->memory()->write_barrier(this, obj);
}
示例8: encoding
void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text,
FXTEXT_CHARPOS* charPos,
CFX_Font* cFont,
FX_FLOAT geWidth,
int32_t fontSize,
FX_FLOAT& charsLen) {
std::unique_ptr<CFX_UnicodeEncodingEx> encoding(
FX_CreateFontEncodingEx(cFont));
int32_t length = text.GetLength();
uint32_t* pCharCode = FX_Alloc(uint32_t, text.GetLength());
FX_FLOAT charWidth = 0;
for (int32_t j = 0; j < text.GetLength(); j++) {
pCharCode[j] = encoding->CharCodeFromUnicode(text[j]);
int32_t glyp_code = encoding->GlyphFromCharCode(pCharCode[j]);
int32_t glyp_value = cFont->GetGlyphWidth(glyp_code);
FX_FLOAT temp = (FX_FLOAT)((glyp_value)*fontSize / 1000.0);
charWidth += temp;
}
charsLen = charWidth;
FX_FLOAT leftPositon = (FX_FLOAT)(geWidth - charsLen) / 2.0f;
if (leftPositon < 0 && geWidth == 0) {
leftPositon = 0;
}
FX_FLOAT penX = 0.0;
FX_FLOAT penY =
(FX_FLOAT)FXSYS_abs(cFont->GetDescent()) * (FX_FLOAT)fontSize / 1000.0f;
FX_FLOAT left = leftPositon;
FX_FLOAT top = 0.0;
charPos[0].m_OriginX = penX + left;
charPos[0].m_OriginY = penY + top;
charPos[0].m_GlyphIndex = encoding->GlyphFromCharCode(pCharCode[0]);
charPos[0].m_FontCharWidth = cFont->GetGlyphWidth(charPos[0].m_GlyphIndex);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
charPos[0].m_ExtGID = charPos[0].m_GlyphIndex;
#endif
penX += (FX_FLOAT)(charPos[0].m_FontCharWidth) * (FX_FLOAT)fontSize / 1000.0f;
for (int32_t i = 1; i < length; i++) {
charPos[i].m_OriginX = penX + left;
charPos[i].m_OriginY = penY + top;
charPos[i].m_GlyphIndex = encoding->GlyphFromCharCode(pCharCode[i]);
charPos[i].m_FontCharWidth = cFont->GetGlyphWidth(charPos[i].m_GlyphIndex);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
charPos[i].m_ExtGID = charPos[i].m_GlyphIndex;
#endif
penX +=
(FX_FLOAT)(charPos[i].m_FontCharWidth) * (FX_FLOAT)fontSize / 1000.0f;
}
FX_Free(pCharCode);
}
示例9: String
String InspectorResource::sourceString() const
{
if (!m_xmlHttpResponseText.isNull())
return String(m_xmlHttpResponseText);
String textEncodingName;
RefPtr<SharedBuffer> buffer = resourceData(&textEncodingName);
if (!buffer)
return String();
TextEncoding encoding(textEncodingName);
if (!encoding.isValid())
encoding = WindowsLatin1Encoding();
return encoding.decode(buffer->data(), buffer->size());
}
示例10: guard
Object* Dir::read(STATE) {
guard(state);
struct dirent ent;
struct dirent* entp = &ent;
if(int erno = readdir_r(os(), entp, &entp)) {
Exception::raise_errno_error(state, "readdir_r(3) failed", erno);
}
if(!entp) return cNil;
String* str = String::create(state, ent.d_name);
str->encoding(state, encoding());
return str;
}
示例11: encoding
document gz_corpus::next()
{
class_label label{"[none]"};
if (class_stream_)
std::getline(class_stream_, static_cast<std::string&>(label));
std::string line;
std::getline(corpus_stream_, line);
document doc{cur_id_++, label};
doc.content(line, encoding());
doc.mdata(next_metadata());
return doc;
}
示例12: ExpatParser_initialize
/**
* Creates a new Expat parser. Called from the Java ExpatParser constructor.
*
* @param object the Java ExpatParser instance
* @param javaEncoding the character encoding name
* @param processNamespaces true if the parser should handle namespaces
* @returns the pointer to the C Expat parser
*/
static jlong ExpatParser_initialize(JNIEnv* env, jobject object, jstring javaEncoding,
jboolean processNamespaces) {
// Allocate parsing context.
UniquePtr<ParsingContext> context(new ParsingContext(object));
if (context.get() == NULL) {
jniThrowOutOfMemoryError(env, NULL);
return 0;
}
context->processNamespaces = processNamespaces;
// Create a parser.
XML_Parser parser;
ScopedUtfChars encoding(env, javaEncoding);
if (encoding.c_str() == NULL) {
return 0;
}
if (processNamespaces) {
// Use '|' to separate URIs from local names.
parser = XML_ParserCreateNS(encoding.c_str(), '|');
} else {
parser = XML_ParserCreate(encoding.c_str());
}
if (parser != NULL) {
if (processNamespaces) {
XML_SetNamespaceDeclHandler(parser, startNamespace, endNamespace);
XML_SetReturnNSTriplet(parser, 1);
}
XML_SetCdataSectionHandler(parser, startCdata, endCdata);
XML_SetCharacterDataHandler(parser, text);
XML_SetCommentHandler(parser, comment);
XML_SetDoctypeDeclHandler(parser, startDtd, endDtd);
XML_SetElementHandler(parser, startElement, endElement);
XML_SetExternalEntityRefHandler(parser, handleExternalEntity);
XML_SetNotationDeclHandler(parser, notationDecl);
XML_SetProcessingInstructionHandler(parser, processingInstruction);
XML_SetUnparsedEntityDeclHandler(parser, unparsedEntityDecl);
XML_SetUserData(parser, context.release());
} else {
jniThrowOutOfMemoryError(env, NULL);
return 0;
}
return fromXMLParser(parser);
}
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_libcore,代码行数:55,代码来源:org_apache_harmony_xml_ExpatParser.cpp
示例13: cs
bool
KSpellConfig::writeGlobalSettings ()
{
TDEConfigGroupSaver cs( kc,"KSpell" );
kc->writeEntry ("KSpell_NoRootAffix",(int) noRootAffix(), true, true);
kc->writeEntry ("KSpell_RunTogether", (int) runTogether(), true, true);
kc->writeEntry ("KSpell_Dictionary", dictionary(), true, true);
kc->writeEntry ("KSpell_DictFromList",(int) dictFromList(), true, true);
kc->writeEntry ("KSpell_Encoding", (int) encoding(),
true, true);
kc->writeEntry ("KSpell_Client", client(),
true, true);
kc->sync();
return true;
}
示例14: Buffer
TextBuffer::TextBuffer( InfTextBuffer *infBuffer,
QObject *parent,
bool own_gobject )
: Buffer( INF_BUFFER(infBuffer), parent, own_gobject )
, m_codec( 0 )
, m_encoder( 0 )
{
m_codec = QTextCodec::codecForName( encoding().toAscii() );
if( m_codec )
m_encoder = m_codec->makeEncoder();
erase_text_handler = g_signal_connect_after( gobject(),
"text-erased", G_CALLBACK(TextBuffer::text_erased_cb),
this );
insert_text_handler = g_signal_connect_after( gobject(),
"text-inserted", G_CALLBACK(TextBuffer::text_inserted_cb),
this );
}
示例15: encoding
TextDecoder* TextDecoder::create(const String& label, const Dictionary& options, ExceptionState& exceptionState)
{
WTF::TextEncoding encoding(label);
// The replacement encoding is not valid, but the Encoding API also
// rejects aliases of the replacement encoding.
if (!encoding.isValid() || !strcasecmp(encoding.name(), "replacement")) {
exceptionState.throwTypeError("The encoding label provided ('" + label + "') is invalid.");
return 0;
}
bool fatal = false;
options.get("fatal", fatal);
bool ignoreBOM = false;
options.get("ignoreBOM", ignoreBOM);
return new TextDecoder(encoding, fatal, ignoreBOM);
}