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


C++ writeValue函数代码示例

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


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

示例1: pushValue

void 
StyledWriter::writeArrayValue( const Value &value )
{
   unsigned size = value.size();
   if ( size == 0 )
      pushValue( "[]" );
   else
   {
      bool isArrayMultiLine = isMultineArray( value );
      if ( isArrayMultiLine )
      {
         writeWithIndent( "[" );
         indent();
         bool hasChildValue = !childValues_.empty();
         unsigned index =0;
         while ( true )
         {
            const Value &childValue = value[index];
            writeCommentBeforeValue( childValue );
            if ( hasChildValue )
               writeWithIndent( childValues_[index] );
            else
            {
               writeIndent();
               writeValue( childValue );
            }
            if ( ++index == size )
            {
               writeCommentAfterValueOnSameLine( childValue );
               break;
            }
            document_ += ",";
            writeCommentAfterValueOnSameLine( childValue );
         }
         unindent();
         writeWithIndent( "]" );
      }
      else // output on a single line
      {
         assert( childValues_.size() == size );
         document_ += "[ ";
         for ( unsigned index =0; index < size; ++index )
         {
            if ( index > 0 )
               document_ += ", ";
            document_ += childValues_[index];
         }
         document_ += " ]";
      }
   }
}
开发者ID:36451,项目名称:MCServer,代码行数:51,代码来源:json_writer.cpp

示例2: Service_Write

void Service_Write(UA_Server *server, UA_Session *session, const UA_WriteRequest *request,
                   UA_WriteResponse *response) {
    UA_assert(server != UA_NULL && session != UA_NULL && request != UA_NULL && response != UA_NULL);

    if(request->nodesToWriteSize <= 0){
        response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
        return;
    }

    response->results = UA_Array_new(&UA_TYPES[UA_TYPES_STATUSCODE], request->nodesToWriteSize);
    if(!response->results) {
        response->responseHeader.serviceResult = UA_STATUSCODE_BADOUTOFMEMORY;
        return;
    }

#ifdef UA_EXTERNAL_NAMESPACES
#ifdef NO_ALLOCA
    UA_Boolean isExternal[request->nodesToWriteSize];
    UA_UInt32 indices[request->nodesToWriteSize];
#else
    UA_Boolean *isExternal = UA_alloca(sizeof(UA_Boolean) * request->nodesToWriteSize);
    UA_UInt32 *indices = UA_alloca(sizeof(UA_UInt32) * request->nodesToWriteSize);
#endif /*NO_ALLOCA */
    UA_memset(isExternal, UA_FALSE, sizeof(UA_Boolean)*request->nodesToWriteSize);
    for(size_t j = 0; j < server->externalNamespacesSize; j++) {
        UA_UInt32 indexSize = 0;
        for(UA_Int32 i = 0; i < request->nodesToWriteSize; i++) {
            if(request->nodesToWrite[i].nodeId.namespaceIndex !=
               server->externalNamespaces[j].index)
                continue;
            isExternal[i] = UA_TRUE;
            indices[indexSize] = i;
            indexSize++;
        }
        if(indexSize == 0)
            continue;
        UA_ExternalNodeStore *ens = &server->externalNamespaces[j].externalNodeStore;
        ens->writeNodes(ens->ensHandle, &request->requestHeader, request->nodesToWrite,
                        indices, indexSize, response->results, response->diagnosticInfos);
    }
#endif
    
    response->resultsSize = request->nodesToWriteSize;
    for(UA_Int32 i = 0;i < request->nodesToWriteSize;i++) {
#ifdef UA_EXTERNAL_NAMESPACES
        if(!isExternal[i])
#endif
            response->results[i] = writeValue(server, &request->nodesToWrite[i]);
    }
}
开发者ID:hfaham,项目名称:open62541,代码行数:50,代码来源:ua_services_attribute.c

示例3: file

bool CSVModelWriter::write() {
    QFile file(filename);
    if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) return false;
    QTextStream out(&file);

    int numRows = 0;
    if (model) {
        numRows = model->rowCount();
    }

    // Header row
    for (int i = 0; i < columns.size(); ++i) {
        if (i != 0) {
            writeSep(out);
        }
        writeValue(out, columns[i].title);
    }
    writeNewline(out);

    // Data rows
    for (int j = 0; j < numRows; ++j) {
        for (int i = 0; i < columns.size(); ++i) {
            if (i != 0) {
                writeSep(out);
            }
            QVariant data =
                model->index(j, columns[i].column).data(columns[i].role);
            writeValue(out, data.toString());
        }
        writeNewline(out);
    }

    file.close();

    return file.error() == QFile::NoError;
}
开发者ID:a7853z,项目名称:bitcoin-abc,代码行数:36,代码来源:csvmodelwriter.cpp

示例4: beginValue

 Writer& Writer::writeFloatValueImpl(T value)
 {
     if (std::isfinite(value))
     {
         beginValue();
         *m_Stream << value;
         m_State = AT_END_OF_VALUE;
     }
     else if (!languageExtension(NON_FINITE_FLOATS_AS_STRINGS))
     {
         YSON_THROW(std::string("Illegal floating point value '")
                    + std::to_string(value) + "'");
     }
     else
     {
         if (std::isnan(value))
             writeValue("NaN");
         else if (value < 0)
             writeValue("-infinity");
         else
             writeValue("infinity");
     }
     return *this;
 }
开发者ID:jebreimo,项目名称:Yson,代码行数:24,代码来源:Writer.cpp

示例5: userReturnPressed

/*!
    The user has pressed return.
    Note, it doesn't matter if the user presses return and both this function
    AND userReturnPressed() is called since setText is called in each to clear
    the 'isModified' flag. So, the first called will perform the write, the
    second (if any) will do nothing.
*/
void QCaLineEdit::userReturnPressed() {

    /// Get the variable to write to
    QCaString *qca = (QCaString*)getQcaItem(0);

    /// If a QCa object is present (if there is a variable to write to)
    /// and the object is set up to write when the user presses return
    /// then write the value.
    /// Note, write even if the value has not changed (isModified() is not checked)

    if( qca && writeOnEnter )
    {
        writeValue( qca, text() );
    }
}
开发者ID:emayssat,项目名称:sandbox,代码行数:22,代码来源:QCaLineEdit.cpp

示例6: writeValue

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int H5FilterParametersWriter::writeValue(const QString name, QVector<AxisAngleInput_t> v)
{
  int numQFilters = static_cast<int>( v.size() );
  int err = writeValue(name,  numQFilters);
  if (err < 0)
  {
    return err;
  }
  QString parseOrder = "Angle, H, K, L";
  err = QH5Lite::writeStringAttribute(m_CurrentGroupId, name, "Data Order", parseOrder);
  if (err < 0)
  {
    return err;
  }
  for(int i = 0; i < numQFilters; i++)
  {
    err = writeValue(name, v[i], i);
    if (err < 0)
    {
      return err;
    }
  }
  return err;
}
开发者ID:ravishivaraman,项目名称:DREAM3D,代码行数:27,代码来源:H5FilterParametersWriter.cpp

示例7: QgsDebugMsg

bool QgsRasterBlock::setValue( qgssize index, double value )
{
  if ( !mData )
  {
    QgsDebugMsg( "Data block not allocated" );
    return false;
  }
  if ( index >= static_cast< qgssize >( mWidth ) *mHeight )
  {
    QgsDebugMsg( QString( "Index %1 out of range (%2 x %3)" ).arg( index ).arg( mWidth ).arg( mHeight ) );
    return false;
  }
  writeValue( mData, mDataType, index, value );
  return true;
}
开发者ID:Benardi-atmadja,项目名称:QGIS,代码行数:15,代码来源:qgsrasterblock.cpp

示例8: writeAttrValue

static void writeAttrValue(OFile *fp, VObject *o)
{
    if (NAME_OF(o)) {
	struct PreDefProp *pi;
	pi = lookupPropInfo(NAME_OF(o));
	if (pi && ((pi->flags & PD_INTERNAL) != 0)) return;
	appendcOFile(fp,';');
	appendsOFile(fp,NAME_OF(o));
	}
    else
	appendcOFile(fp,';');
    if (VALUE_TYPE(o)) {
	appendcOFile(fp,'=');
	writeValue(fp,o,0);
	}
}
开发者ID:pvuorela,项目名称:kcalcore,代码行数:16,代码来源:vobject.c

示例9: writeMap

 void writeMap( std::ostream& stream, const Map& m)
 {
     const unsigned int mapEntries = m.size();
     writeValue( stream, mapEntries );
     if( mapEntries > 0 )
     {
         const auto& end = m.end();
         for(auto it = m.begin(); it != end; ++it )
         {
             // write key (assume that key is a container)
             writeContainer( stream, (*it).first );
             // write value (assume that value is a container)
             writeContainer( stream, (*it).second );
         }
     }
 }
开发者ID:jepebe,项目名称:opm-autodiff,代码行数:16,代码来源:BackupRestore.hpp

示例10: simplePageHandler

static void simplePageHandler(const edit_element_t *elements, uint8_t len)
{
	NOKEYRETURN;
	edit_element_t element;
	elementKey(len);
	if (KEY4)	// CHANGE?
	{
		memcpy_P(&element, &elements[elementIndex], sizeof(element));
		startEditMode(element.valuePtr, element.loLimit, element.hiLimit, TYPE_UINT8);
		return;
	}
	for (uint8_t i = 0; i < len; i++)
	{
		memcpy_P(&element, &elements[i], sizeof(element));
		writeValue(element.X, element.Y, *(uint8_t*)element.valuePtr, element.len, i);
	}
}
开发者ID:quoctuanuit,项目名称:Quadcopter2015,代码行数:17,代码来源:menu.c

示例11: pushValue

void BuiltStyledStreamWriter::writeArrayValue(Value const& value) {
  unsigned size = value.size();
  if (size == 0)
    pushValue("[]");
  else {
    bool isMultiLine = (cs_ == CommentStyle::All) || isMultineArray(value);
    if (isMultiLine) {
      writeWithIndent("[");
      indent();
      bool hasChildValue = !childValues_.empty();
      unsigned index = 0;
      for (;;) {
        Value const& childValue = value[index];
        writeCommentBeforeValue(childValue);
        if (hasChildValue)
          writeWithIndent(childValues_[index]);
        else {
          if (!indented_) writeIndent();
          indented_ = true;
          writeValue(childValue);
          indented_ = false;
        }
        if (++index == size) {
          writeCommentAfterValueOnSameLine(childValue);
          break;
        }
        sout_ << ",";
        writeCommentAfterValueOnSameLine(childValue);
      }
      unindent();
      writeWithIndent("]");
    } else // output on a single line
    {
      assert(childValues_.size() == size);
      sout_ << "[";
      if (!indentation_.empty()) sout_ << " ";
      for (unsigned index = 0; index < size; ++index) {
        if (index > 0)
          sout_ << ", ";
        sout_ << childValues_[index];
      }
      if (!indentation_.empty()) sout_ << " ";
      sout_ << "]";
    }
  }
}
开发者ID:robsonswiss,项目名称:OSVR-user-settings,代码行数:46,代码来源:json_writer.cpp

示例12: writeValue

static QVariant writeValue(QString path, QVariantMap input, QVariant value)
{
	if(path.size() > 1)
	{

		QString entryName = path.section('/', 0, 1);
		QString remainder = "/" + path.section('/', 2, -1);

		entryName.remove(0, 1);
		input.insert(entryName, writeValue(remainder, input.value(entryName).toMap(), value));
		return input;
	}
	else
	{
		return value;
	}
}
开发者ID:vcmi,项目名称:vcmi,代码行数:17,代码来源:cmodmanager.cpp

示例13: _hCPPMSettings

static void _hCPPMSettings()
{
	NOKEYRETURN;
	uint8_t oldsubpage = elementIndex / 4;
	elementKey(8);
	uint8_t subpage = elementIndex / 4;
	
	if (KEYINIT || KEYREFRESH || oldsubpage != subpage)
		writeCPPMScreen(subpage);
	
	if (KEY4)	// CHANGE?
	{
		startEditMode(&Config.RX_chmap[subpage * 4 + elementIndex - 1], 1, 8, TYPE_UINT8);
		return;
	}
	
	for (int i = 0; i < 4; i++)
		writeValue(2 + i, 13*6, Config.RX_chmap[subpage * 4 + i], 1, i + subpage * 4);
}
开发者ID:quoctuanuit,项目名称:Quadcopter2015,代码行数:19,代码来源:menu.c

示例14: _hReceiverTest

static void _hReceiverTest()
{
	static const char* const info[6][2] PROGMEM = {
		{ strLeft, strRight },
		{ strForward, strBack },
		{ strRight, strLeft },
		{ strIdle, strFull },
		{ strOff, strOn },
		{ strOff, strOn },
	};
	
	for (uint8_t i = 0; i < 6; i++)
	{
		if (RX_good & _BV(i))
		{
			writeValue(i, 66, RX[i], 4, -1);
			lcdSetPos(i, 96);
			if (i == THR)
			{
				if (State.ThrottleOff)
					writePadded_P(strIdle, 5);
				else if (RX[THR] >= RX_THRESHOLD)
					writePadded_P(strFull, 5);
				else
					writeSpace(5);
			}
			else
			{
				if (abs(RX[i]) > (RX_THRESHOLD / 2))
					writePadded_P((PGM_P)pgm_read_word(&info[i][RX[i] > 0]), 5);
				else
					writeSpace(5);
			}
		}
		else
		{
			lcdSetPos(i, 66);
			lcdWriteString_P(strNoSignal);
		}
	}
}
开发者ID:quoctuanuit,项目名称:Quadcopter2015,代码行数:41,代码来源:menu.c

示例15: getQcaItem

//------------------------------------------------------------------------------
// Write a value immediately.
// Used when writeOnLoseFocus, writeOnEnter, writeOnFinish are all false
// (widget will never write due to the user pressing return or leaving the widget)
//
void QEGenericEdit::writeNow ()
{
    // If not connected, do nothing
    if( !isConnected )
    {
        return;
    }

    // Get the variable to write to
   qcaobject::QCaObject *qca = getQcaItem(0);

   // If a QCa object is present (if there is a variable to write to)
   // and is of the corect type then write the value.
   //
   if ( qca ) {
      // Invokes a whole bunch of dialog logic, but eventually calls writeData.
      // Note: getValue is a dispatching hook procedure.
      //
      writeValue( qca, getValue () );
   }
}
开发者ID:rorydog1,项目名称:epics,代码行数:26,代码来源:QEGenericEdit.cpp


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