本文整理汇总了C++中WriteValue函数的典型用法代码示例。如果您正苦于以下问题:C++ WriteValue函数的具体用法?C++ WriteValue怎么用?C++ WriteValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了WriteValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CSLCount
bool OGRDXFWriterDS::WriteNewLayerDefinitions( VSILFILE * fpOut )
{
const int nNewLayers = CSLCount(papszLayersToCreate);
for( int iLayer = 0; iLayer < nNewLayers; iLayer++ )
{
for( unsigned i = 0; i < aosDefaultLayerText.size(); i++ )
{
if( anDefaultLayerCode[i] == 2 )
{
if( !WriteValue( fpOut, 2, papszLayersToCreate[iLayer] ) )
return false;
}
else if( anDefaultLayerCode[i] == 5 )
{
WriteEntityID( fpOut );
}
else
{
if( !WriteValue( fpOut,
anDefaultLayerCode[i],
aosDefaultLayerText[i] ) )
return false;
}
}
}
return true;
}
示例2: WriteValue
long OGRDXFWriterDS::WriteEntityID( VSILFILE *fpIn, long nPreferredFID )
{
CPLString osEntityID;
if( nPreferredFID != OGRNullFID )
{
osEntityID.Printf( "%X", (unsigned int) nPreferredFID );
if( !CheckEntityID( osEntityID ) )
{
aosUsedEntities.insert( osEntityID );
WriteValue( fpIn, 5, osEntityID );
return nPreferredFID;
}
}
do
{
osEntityID.Printf( "%X", nNextFID++ );
}
while( CheckEntityID( osEntityID ) );
aosUsedEntities.insert( osEntityID );
WriteValue( fpIn, 5, osEntityID );
return nNextFID - 1;
}
示例3: switch
void JsonExpressFormater::WriteExpression(stringx name, ref<JsonNode> node, ref<StringBuilder> sb, int level)
{
switch (node->GetType())
{
case JSN_String:
WriteValue(name, '\"' + node->TextValue() + '\"', sb, level);
break;
case JSN_Integer:
WriteValue(name, Converter::ToString(node->IntValue()), sb, level);
break;
case JSN_Boolean:
WriteValue(name, node->BoolValue() ? __X("true") : __X("false"), sb, level);
break;
case JSN_None:
WriteValue(name, __X("null"), sb, level);
break;
case JSN_Dictionary:
WriteSubDictionary(name, node, sb, level);
break;
case JSN_NodeList:
WriteSubList(name, node, sb, level);
break;
default:
cdec_throw(JsonException(EC_JSON_NotImplemented, 0));
}
}
示例4: AnalyzeData
void AnalyzeData(std::istream& in, std::ostream& out, uint32_t current_time)
{
TypeStatistic stat(c_max_message_type+1);
Data message;
while (in >> message)
{
DataStatistic& act = stat[message.type];
if ((act.message_count) &&(act.current_time != message.time))
act.current_buff_size = 0;
if (act.current_buff_size + message.size <= c_max_message_size)
{
act.current_time = message.time;
if (act.current_buff_size == 0) // first message in this time
{
++act.time_count;
}
act.current_buff_size += message.size;
++act.message_count;
}
}
for(uint32_t i = 0; i <= c_max_message_type; ++i)
if (stat[i].time_count)
{
WriteValue(out, i);
WriteValue(out, stat[i].message_count*1.0/stat[i].time_count);
}
};
示例5: ASSERT
/////////////////////////////////////////////////////////////////////
/// Partitions a rectangular region of a given subband.
/// Partitioning scheme: The plane is partitioned in squares of side length LinBlockSize.
/// Write wavelet coefficients from subband into the input buffer of a macro block.
/// It might throw an IOException.
/// @param band A subband
/// @param width The width of the rectangle
/// @param height The height of the rectangle
/// @param startPos The absolute subband position of the top left corner of the rectangular region
/// @param pitch The number of bytes in row of the subband
void CEncoder::Partition(CSubband* band, int width, int height, int startPos, int pitch) {
ASSERT(band);
const div_t hh = div(height, LinBlockSize);
const div_t ww = div(width, LinBlockSize);
const int ws = pitch - LinBlockSize;
const int wr = pitch - ww.rem;
int pos, base = startPos, base2;
// main height
for (int i=0; i < hh.quot; i++) {
// main width
base2 = base;
for (int j=0; j < ww.quot; j++) {
pos = base2;
for (int y=0; y < LinBlockSize; y++) {
for (int x=0; x < LinBlockSize; x++) {
WriteValue(band, pos);
pos++;
}
pos += ws;
}
base2 += LinBlockSize;
}
// rest of width
pos = base2;
for (int y=0; y < LinBlockSize; y++) {
for (int x=0; x < ww.rem; x++) {
WriteValue(band, pos);
pos++;
}
pos += wr;
base += pitch;
}
}
// main width
base2 = base;
for (int j=0; j < ww.quot; j++) {
// rest of height
pos = base2;
for (int y=0; y < hh.rem; y++) {
for (int x=0; x < LinBlockSize; x++) {
WriteValue(band, pos);
pos++;
}
pos += ws;
}
base2 += LinBlockSize;
}
// rest of height
pos = base2;
for (int y=0; y < hh.rem; y++) {
// rest of width
for (int x=0; x < ww.rem; x++) {
WriteValue(band, pos);
pos++;
}
pos += wr;
}
}
示例6: BuildComposedKey
bool CBratSettings::SaveConfigSelectionCriteria()
{
CMapProduct& mapProductInstance = CMapProduct::GetInstance();
for ( CObMap::iterator it = mapProductInstance.begin(); it != mapProductInstance.end(); it++ )
{
CProduct* product = dynamic_cast<CProduct*>( it->second );
if ( product == nullptr || !product->HasCriteriaInfo() )
continue;
std::string config_path = BuildComposedKey( { GROUP_SEL_CRITERIA, product->GetLabel() } );
{
CSection section( mSettings, config_path );
if ( product->IsSetLatLonCriteria() )
WriteValue( section, ENTRY_LAT_LON, product->GetLatLonCriteria()->GetAsText() );
if ( product->IsSetDatetimeCriteria() )
WriteValue( section, ENTRY_DATETIME, product->GetDatetimeCriteria()->GetAsText() );
if ( product->IsSetCycleCriteria() )
WriteValue( section, ENTRY_CYCLE, product->GetCycleCriteria()->GetAsText() );
if ( product->IsSetPassIntCriteria() )
WriteValue( section, ENTRY_PASS_NUMBER, product->GetPassIntCriteria()->GetAsText() );
if ( product->IsSetPassStringCriteria() )
WriteValue( section, ENTRY_PASS_STRING, product->GetPassStringCriteria()->GetAsText() );
}
Sync();
}
return mSettings.status() == QSettings::NoError;
}
示例7: if
int CGXCommunication::ReadScalerAndUnits()
{
int ret = 0;
std::string str;
std::string ln;
std::vector<std::pair<CGXDLMSObject*, unsigned char> > list;
if ((m_Parser->GetNegotiatedConformance() & DLMS_CONFORMANCE_MULTIPLE_REFERENCES) != 0)
{
// Read scalers and units from the device.
for (std::vector<CGXDLMSObject*>::iterator it = m_Parser->GetObjects().begin(); it != m_Parser->GetObjects().end(); ++it)
{
if ((*it)->GetObjectType() == DLMS_OBJECT_TYPE_REGISTER ||
(*it)->GetObjectType() == DLMS_OBJECT_TYPE_EXTENDED_REGISTER)
{
list.push_back(std::make_pair(*it, 3));
}
else if ((*it)->GetObjectType() == DLMS_OBJECT_TYPE_DEMAND_REGISTER)
{
list.push_back(std::make_pair(*it, 4));
}
}
if ((ret = ReadList(list)) != 0)
{
printf("Err! Failed to read register: %s", CGXDLMSConverter::GetErrorMessage(ret));
m_Parser->SetNegotiatedConformance((DLMS_CONFORMANCE)(m_Parser->GetNegotiatedConformance() & ~DLMS_CONFORMANCE_MULTIPLE_REFERENCES));
}
}
if ((m_Parser->GetNegotiatedConformance() & DLMS_CONFORMANCE_MULTIPLE_REFERENCES) == 0)
{
//If readlist is not supported read one value at the time.
for (std::vector<CGXDLMSObject*>::iterator it = m_Parser->GetObjects().begin(); it != m_Parser->GetObjects().end(); ++it)
{
if ((*it)->GetObjectType() == DLMS_OBJECT_TYPE_REGISTER ||
(*it)->GetObjectType() == DLMS_OBJECT_TYPE_EXTENDED_REGISTER)
{
(*it)->GetLogicalName(ln);
WriteValue(m_Trace, ln.c_str());
if ((ret = Read(*it, 3, str)) != 0)
{
printf("Err! Failed to read register: %s %s", ln.c_str(), CGXDLMSConverter::GetErrorMessage(ret));
//Continue reading.
continue;
}
}
else if ((*it)->GetObjectType() == DLMS_OBJECT_TYPE_DEMAND_REGISTER)
{
(*it)->GetLogicalName(ln);
WriteValue(m_Trace, ln.c_str());
if ((ret = Read(*it, 4, str)) != 0)
{
printf("Err! Failed to read register: %s %s", ln.c_str(), CGXDLMSConverter::GetErrorMessage(ret));
//Continue reading.
continue;
}
}
}
}
return ret;
}
示例8: SQLExtendedFetch
SQLRETURN SQL_API
SQLExtendedFetch(SQLHSTMT StatementHandle,
SQLUSMALLINT FetchOrientation,
SQLLEN FetchOffset,
#ifdef BUILD_REAL_64_BIT_MODE /* note: only defined on Debian Lenny */
SQLUINTEGER *RowCountPtr,
#else
SQLULEN *RowCountPtr,
#endif
SQLUSMALLINT *RowStatusArray)
{
ODBCStmt *stmt = (ODBCStmt *) StatementHandle;
SQLRETURN rc;
#ifdef ODBCDEBUG
ODBCLOG("SQLExtendedFetch " PTRFMT " %s " LENFMT " " PTRFMT " " PTRFMT "\n",
PTRFMTCAST StatementHandle,
translateFetchOrientation(FetchOrientation),
LENCAST FetchOffset, PTRFMTCAST RowCountPtr,
PTRFMTCAST RowStatusArray);
#endif
if (!isValidStmt(stmt))
return SQL_INVALID_HANDLE;
clearStmtErrors(stmt);
/* check statement cursor state, query should be executed */
if (stmt->State < EXECUTED0 || stmt->State == FETCHED) {
/* Function sequence error */
addStmtError(stmt, "HY010", NULL, 0);
return SQL_ERROR;
}
if (stmt->State == EXECUTED0) {
/* Invalid cursor state */
addStmtError(stmt, "24000", NULL, 0);
return SQL_ERROR;
}
rc = MNDBFetchScroll(stmt, FetchOrientation, FetchOffset,
RowStatusArray);
if (SQL_SUCCEEDED(rc) || rc == SQL_NO_DATA)
stmt->State = EXTENDEDFETCHED;
if (SQL_SUCCEEDED(rc) && RowCountPtr) {
#ifdef BUILD_REAL_64_BIT_MODE /* note: only defined on Debian Lenny */
WriteValue(RowCountPtr, (SQLUINTEGER) stmt->rowSetSize);
#else
WriteValue(RowCountPtr, (SQLULEN) stmt->rowSetSize);
#endif
}
return rc;
}
示例9: PingReply
void PingReply(Host Session_SN, ushort Reply2ID)
{
uchar Request[0xFF];
ushort TransID;
uchar *PRequest, *Mark;
uint Size, SizeSz;
ObjectDesc ObjNbr;
PRequest = Request;
ZeroMemory(Request, 0xFF);
TransID = BytesRandomWord();
if (0xFFFF - TransID < 0x1000)
TransID -= 0x1000;
*(unsigned short *)PRequest = htons(TransID);
PRequest += 2;
Mark = PRequest;
WriteValue(&PRequest, 0x0A);
WriteValue(&PRequest, 0x293);
*(unsigned short *)PRequest = htons(Reply2ID);
PRequest += 2;
*PRequest++ = RAW_PARAMS;
WriteValue(&PRequest, 0x02);
ObjNbr.Family = OBJ_FAMILY_NBR;
ObjNbr.Id = 0x01;
ObjNbr.Value.Nbr = 0x02;
WriteObject(&PRequest, ObjNbr);
ObjNbr.Family = OBJ_FAMILY_NBR;
ObjNbr.Id = 0x08;
ObjNbr.Value.Nbr = 0x0A;
WriteObject(&PRequest, ObjNbr);
Size = (uint)(PRequest - Request);
SizeSz = GetWrittenSz(Size << 1);
PRequest = Request;
memmove_s(Request + SizeSz, 0xFF, Request, 0xFF - SizeSz);
WriteValue(&PRequest , Size << 1);
Size += SizeSz;
CipherTCP(&(Keys.SendStream), Request, 3);
CipherTCP(&(Keys.SendStream), Request + 3, Size - 3);
printf("Sending Ping Response..\n");
NoWait = 1;
SendPacketTCP(Session_SN.socket, Session_SN, Request, Size, HTTPS_PORT, &(Session_SN.Connected));
}
示例10: WriteValue
OGRErr OGRDXFWriterLayer::WriteCore( OGRFeature *poFeature )
{
/* -------------------------------------------------------------------- */
/* Write out an entity id. I'm not sure why this is critical, */
/* but it seems that VoloView will just quietly fail to open */
/* dxf files without entity ids set on most/all entities. */
/* Also, for reasons I don't understand these ids seem to have */
/* to start somewhere around 0x50 hex (80 decimal). */
/* -------------------------------------------------------------------- */
poFeature->SetFID( poDS->WriteEntityID(fp,(int)poFeature->GetFID()) );
/* -------------------------------------------------------------------- */
/* For now we assign everything to the default layer - layer */
/* "0" - if there is no layer property on the source features. */
/* -------------------------------------------------------------------- */
const char *pszLayer = poFeature->GetFieldAsString( "Layer" );
if( pszLayer == nullptr || strlen(pszLayer) == 0 )
{
WriteValue( 8, "0" );
}
else
{
CPLString osSanitizedLayer(pszLayer);
// Replaced restricted characters with underscore
// See http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%202010%20User%20Documentation/index.html?url=WS1a9193826455f5ffa23ce210c4a30acaf-7345.htm,topicNumber=d0e41665
const char achForbiddenChars[] = {
'<', '>', '/', '\\', '"', ':', ';', '?', '*', '|', '=', '\'' };
for( size_t i = 0; i < CPL_ARRAYSIZE(achForbiddenChars); ++i )
{
osSanitizedLayer.replaceAll( achForbiddenChars[i], '_' );
}
// also remove newline characters (#15067)
osSanitizedLayer.replaceAll( "\r\n", "_" );
osSanitizedLayer.replaceAll( '\r', '_' );
osSanitizedLayer.replaceAll( '\n', '_' );
const char *pszExists =
poDS->oHeaderDS.LookupLayerProperty( osSanitizedLayer, "Exists" );
if( (pszExists == nullptr || strlen(pszExists) == 0)
&& CSLFindString( poDS->papszLayersToCreate, osSanitizedLayer ) == -1 )
{
poDS->papszLayersToCreate =
CSLAddString( poDS->papszLayersToCreate, osSanitizedLayer );
}
WriteValue( 8, osSanitizedLayer );
}
return OGRERR_NONE;
}
示例11: sprintf_s
int CGXCommunication::GetReadOut()
{
int ret = 0;
char buff[200];
std::string value;
for (std::vector<CGXDLMSObject*>::iterator it = m_Parser->GetObjects().begin(); it != m_Parser->GetObjects().end(); ++it)
{
// Profile generics are read later because they are special cases.
// (There might be so lots of data and we so not want waste time to read all the data.)
if ((*it)->GetObjectType() == DLMS_OBJECT_TYPE_PROFILE_GENERIC)
{
continue;
}
#if _MSC_VER > 1000
sprintf_s(buff, 200, "-------- Reading %s %s %s\r\n", CGXDLMSClient::ObjectTypeToString((*it)->GetObjectType()).c_str(), (*it)->GetName().ToString().c_str(), (*it)->GetDescription().c_str());
#else
sprintf(buff, "-------- Reading %s %s %s\r\n", CGXDLMSClient::ObjectTypeToString((*it)->GetObjectType()).c_str(), (*it)->GetName().ToString().c_str(), (*it)->GetDescription().c_str());
#endif
WriteValue(m_Trace, buff);
std::vector<int> attributes;
(*it)->GetAttributeIndexToRead(attributes);
for (std::vector<int>::iterator pos = attributes.begin(); pos != attributes.end(); ++pos)
{
value.clear();
if ((ret = Read(*it, *pos, value)) != DLMS_ERROR_CODE_OK)
{
#if _MSC_VER > 1000
sprintf_s(buff, 100, "Error! Index: %d %s\r\n", *pos, CGXDLMSConverter::GetErrorMessage(ret));
#else
sprintf(buff, "Error! Index: %d read failed: %s\r\n", *pos, CGXDLMSConverter::GetErrorMessage(ret));
#endif
WriteValue(GX_TRACE_LEVEL_ERROR, buff);
//Continue reading.
}
else
{
#if _MSC_VER > 1000
sprintf_s(buff, 100, "Index: %d Value: ", *pos);
#else
sprintf(buff, "Index: %d Value: ", *pos);
#endif
WriteValue(m_Trace, buff);
WriteValue(m_Trace, value.c_str());
WriteValue(m_Trace, "\r\n");
}
}
}
return ret;
}
示例12: ConvertFromMessage
static void ConvertFromMessage(FXmppMessageJingle& OutMessageJingle, const FXmppMessage& InMessage)
{
FXmppJingle::ConvertFromJid(OutMessageJingle.FromJid, InMessage.FromJid);
FXmppJingle::ConvertFromJid(OutMessageJingle.ToJid, InMessage.ToJid);
FString Body;
auto JsonWriter = TJsonWriterFactory<TCHAR, TCondensedJsonPrintPolicy<TCHAR> >::Create(&Body);
JsonWriter->WriteObjectStart();
JsonWriter->WriteValue(TEXT("type"), InMessage.Type);
JsonWriter->WriteValue(TEXT("payload"), InMessage.Payload);
JsonWriter->WriteValue(TEXT("timestamp"), FDateTime::UtcNow().ToIso8601());
JsonWriter->WriteObjectEnd();
JsonWriter->Close();
OutMessageJingle.Body = TCHAR_TO_UTF8(*Body);
}
示例13: CHECK_HR
HRESULT AbstractDeviceContent::WriteValues(
_In_ IPortableDeviceValues* pValues,
_Inout_ IPortableDeviceValues* pResults,
_Out_ bool* pbObjectChanged)
{
HRESULT hr = S_OK;
DWORD cValues = 0;
bool hasFailedWrite = false;
if (pValues == NULL || pResults == NULL || pbObjectChanged == NULL)
{
hr = E_POINTER;
CHECK_HR(hr, "Cannot have NULL parameter");
return hr;
}
hr = pValues->GetCount(&cValues);
CHECK_HR(hr, "Failed to get total number of values");
(*pbObjectChanged) = false;
for (DWORD dwIndex = 0; dwIndex < cValues; dwIndex++)
{
PROPERTYKEY Key = WPD_PROPERTY_NULL;
PROPVARIANT Value;
PropVariantInit(&Value);
hr = pValues->GetAt(dwIndex, &Key, &Value);
CHECK_HR(hr, "Failed to get PROPERTYKEY at index %d", dwIndex);
if (hr == S_OK)
{
HRESULT hrWrite = WriteValue(Key, Value);
if (FAILED(hrWrite))
{
CHECK_HR(hrWrite, "Failed to write value at index %d", dwIndex);
hasFailedWrite = true;
}
else
{
(*pbObjectChanged) = true;
}
hr = pResults->SetErrorValue(Key, hrWrite);
CHECK_HR(hr, "Failed to set error result value at index %d", dwIndex);
}
PropVariantClear(&Value);
}
// Since we have set failures for the property set operations we must let the application
// know by returning S_FALSE. This will instruct the application to look at the
// property set operation results for failure values.
if ((hr == S_OK) && hasFailedWrite)
{
hr = S_FALSE;
}
return hr;
}
示例14: WriteData
void StdCompilerBinWrite::String(char **pszString, RawCompileType eType)
{
if (*pszString)
WriteData(*pszString, strlen(*pszString) + 1);
else
WriteValue('\0');
}
示例15: stdID
void PropEditCtrlXRCID::OnDetails()
{
wxString choices[] = {wxString(_T("-1"))
#define stdID(id) , wxString(#id)
stdID(wxID_OK) stdID(wxID_CANCEL)
stdID(wxID_YES) stdID(wxID_NO)
stdID(wxID_APPLY) stdID(wxID_HELP)
stdID(wxID_HELP_CONTEXT)
stdID(wxID_OPEN) stdID(wxID_CLOSE) stdID(wxID_NEW)
stdID(wxID_SAVE) stdID(wxID_SAVEAS) stdID(wxID_REVERT)
stdID(wxID_EXIT) stdID(wxID_UNDO) stdID(wxID_REDO)
stdID(wxID_PRINT) stdID(wxID_PRINT_SETUP)
stdID(wxID_PREVIEW) stdID(wxID_ABOUT) stdID(wxID_HELP_CONTENTS)
stdID(wxID_HELP_COMMANDS) stdID(wxID_HELP_PROCEDURES)
stdID(wxID_CUT) stdID(wxID_COPY) stdID(wxID_PASTE)
stdID(wxID_CLEAR) stdID(wxID_FIND) stdID(wxID_DUPLICATE)
stdID(wxID_SELECTALL)
stdID(wxID_STATIC) stdID(wxID_FORWARD) stdID(wxID_BACKWARD)
stdID(wxID_DEFAULT) stdID(wxID_MORE) stdID(wxID_SETUP)
stdID(wxID_RESET)
#undef stdID
};
wxString s =
wxGetSingleChoice(_("Choose from predefined IDs:"), _("XRCID"),
38/*sizeof choices*/, choices);
if (!s) return;
m_TextCtrl->SetValue(s);
WriteValue();
EditorFrame::Get()->NotifyChanged(CHANGED_PROPS);
}