Пример #1
0
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_ += " ]";
      }
   }
}
Пример #2
0
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]);
    }
}
Пример #3
0
	}END_TEST

START_TEST(WriteSingleAttributeNoValue)
	{
		UA_Server *server = makeTestSequence();

		UA_WriteValue wValue;
		UA_WriteValue_init(&wValue);
		wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
		wValue.attributeId = UA_ATTRIBUTEID_USEREXECUTABLE;
		wValue.value.hasValue = UA_FALSE;
		UA_StatusCode retval = writeValue(server, &wValue);
		ck_assert_int_eq(retval, UA_STATUSCODE_BADTYPEMISMATCH);
	}END_TEST
Пример #4
0
	}END_TEST

START_TEST(WriteSingleAttributeDataType)
	{
		UA_Server *server = makeTestSequence();

		UA_WriteValue wValue;
		UA_WriteValue_init(&wValue);
		wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
		wValue.attributeId = UA_ATTRIBUTEID_DATATYPE;
		wValue.value.hasValue = UA_TRUE;
		UA_StatusCode retval = writeValue(server, &wValue);
		ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
	}END_TEST
Пример #5
0
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;
}
Пример #6
0
 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;
 }
Пример #7
0
int BuiltStyledStreamWriter::write(Value const& root, std::ostream* sout)
{
    sout_ = sout;
    addChildValues_ = false;
    indented_ = true;
    indentString_ = "";
    writeCommentBeforeValue(root);
    if (!indented_) writeIndent();
    indented_ = true;
    writeValue(root);
    writeCommentAfterValueOnSameLine(root);
    *sout_ << endingLineFeedSymbol_;
    sout_ = NULL;
    return 0;
}
Пример #8
0
/*!
    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() );
    }
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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;
}
Пример #10
0
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;
}
Пример #11
0
	}END_TEST

START_TEST(WriteSingleAttributeBrowseName)
	{
		UA_Server *server = makeTestSequence();
		
		UA_WriteValue wValue;
		UA_WriteValue_init(&wValue);
		UA_QualifiedName testValue = UA_QUALIFIEDNAME(1, "the.answer");
		UA_Variant_setScalarCopy(&wValue.value.value, &testValue, &UA_TYPES[UA_TYPES_QUALIFIEDNAME]);
		wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
		wValue.attributeId = UA_ATTRIBUTEID_BROWSENAME;
		wValue.value.hasValue = UA_TRUE;
		UA_StatusCode retval = writeValue(server, &wValue);
		ck_assert_int_eq(retval, UA_STATUSCODE_GOOD);
	}END_TEST
Пример #12
0
	}END_TEST

START_TEST(WriteSingleAttributeUserExecutable)
	{
		UA_Server *server = makeTestSequence();

		UA_WriteValue wValue;
		UA_WriteValue_init(&wValue);
		UA_Boolean testValue = UA_TRUE;
		UA_Variant_setScalarCopy(&wValue.value.value, &testValue, &UA_TYPES[UA_TYPES_BOOLEAN]);
		wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
		wValue.attributeId = UA_ATTRIBUTEID_USEREXECUTABLE;
		wValue.value.hasValue = UA_TRUE;
		UA_StatusCode retval = writeValue(server, &wValue);
		ck_assert_int_eq(retval, UA_STATUSCODE_BADNODECLASSINVALID);
	}END_TEST
Пример #13
0
	}END_TEST

START_TEST(WriteSingleAttributeHistorizing)
	{
		UA_Server *server = makeTestSequence();

		UA_WriteValue wValue;
		UA_WriteValue_init(&wValue);
		UA_Boolean testValue = UA_TRUE;
		UA_Variant_setScalarCopy(&wValue.value.value, &testValue, &UA_TYPES[UA_TYPES_BOOLEAN]);
		wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
		wValue.attributeId = UA_ATTRIBUTEID_HISTORIZING;
		wValue.value.hasValue = UA_TRUE;
		UA_StatusCode retval = writeValue(server, &wValue);
		ck_assert_int_eq(retval, UA_STATUSCODE_GOOD);
	}END_TEST
Пример #14
0
	}END_TEST

START_TEST(WriteSingleAttributeMinimumSamplingInterval)
	{
		UA_Server *server = makeTestSequence();

		UA_WriteValue wValue;
		UA_WriteValue_init(&wValue);
		UA_Double testValue = 0.0;
		UA_Variant_setScalarCopy(&wValue.value.value, &testValue, &UA_TYPES[UA_TYPES_DOUBLE]);
		wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
		wValue.attributeId = UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL;
		wValue.value.hasValue = UA_TRUE;
		UA_StatusCode retval = writeValue(server, &wValue);
		ck_assert_int_eq(retval, UA_STATUSCODE_GOOD);
	}END_TEST
Пример #15
0
	}END_TEST

START_TEST(WriteSingleAttributeUserAccessLevel)
	{
		UA_Server *server = makeTestSequence();

		UA_WriteValue wValue;
		UA_WriteValue_init(&wValue);
		UA_UInt32 testValue = 0;
		UA_Variant_setScalarCopy(&wValue.value.value, &testValue, &UA_TYPES[UA_TYPES_UINT32]);
		wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
		wValue.attributeId = UA_ATTRIBUTEID_USERACCESSLEVEL;
		wValue.value.hasValue = UA_TRUE;
		UA_StatusCode retval = writeValue(server, &wValue);
		ck_assert_int_eq(retval, UA_STATUSCODE_GOOD);
	}END_TEST
Пример #16
0
	}END_TEST

START_TEST(WriteSingleAttributeEventNotifier)
	{
		UA_Server *server = makeTestSequence();

		UA_WriteValue wValue;
		UA_WriteValue_init(&wValue);
		UA_Byte testValue = 0;
		UA_Variant_setScalarCopy(&wValue.value.value, &testValue, &UA_TYPES[UA_TYPES_BYTE]);
		wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
		wValue.attributeId = UA_ATTRIBUTEID_EVENTNOTIFIER;
		wValue.value.hasValue = UA_TRUE;
		UA_StatusCode retval = writeValue(server, &wValue);
		ck_assert_int_eq(retval, UA_STATUSCODE_BADNODECLASSINVALID);
	}END_TEST
Пример #17
0
	}END_TEST

START_TEST(WriteSingleAttributeInverseName)
	{
		UA_Server *server = makeTestSequence();

		UA_WriteValue wValue;
		UA_WriteValue_init(&wValue);
		UA_LocalizedText testValue = UA_LOCALIZEDTEXT("en_US", "not.the.answer");
		UA_Variant_setScalarCopy(&wValue.value.value, &testValue, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
		wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
		wValue.attributeId = UA_ATTRIBUTEID_INVERSENAME;
		wValue.value.hasValue = UA_TRUE;
		UA_StatusCode retval = writeValue(server, &wValue);
		ck_assert_int_eq(retval, UA_STATUSCODE_BADNODECLASSINVALID);
	}END_TEST
Пример #18
0
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);
	}
}
Пример #19
0
 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 );
         }
     }
 }
Пример #20
0
	}END_TEST

START_TEST(WriteSingleAttributeValueRank)
	{
		UA_Server *server = makeTestSequence();

		UA_WriteValue wValue;
		UA_WriteValue_init(&wValue);
		UA_Int32 testValue = -1;
		UA_Variant_setScalarCopy(&wValue.value.value, &testValue, &UA_TYPES[UA_TYPES_INT32]);
		wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
		wValue.attributeId = UA_ATTRIBUTEID_VALUERANK;
		wValue.value.hasValue = UA_TRUE;
		UA_StatusCode retval = writeValue(server, &wValue);
		// Returns attributeInvalid, since variant/value may be writable
		ck_assert_int_eq(retval, UA_STATUSCODE_BADATTRIBUTEIDINVALID);
	}END_TEST
Пример #21
0
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);
	}
}
Пример #22
0
	}END_TEST

START_TEST(WriteSingleAttributeArrayDimensions)
	{
		UA_Server *server = makeTestSequence();

		UA_WriteValue wValue;
		UA_WriteValue_init(&wValue);
		UA_Int32 testValue[] = {-1,-1,-1};
		UA_Variant_setArrayCopy(&wValue.value.value, &testValue, 3, &UA_TYPES[UA_TYPES_INT32]);
		wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
		wValue.attributeId = UA_ATTRIBUTEID_ARRAYDIMENSIONS;
		wValue.value.hasValue = UA_TRUE;
		UA_StatusCode retval = writeValue(server, &wValue);
		// Returns attributeInvalid, since variant/value may be writable
		ck_assert_int_eq(retval, UA_STATUSCODE_BADATTRIBUTEIDINVALID);
	}END_TEST
Пример #23
0
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_ << "]";
    }
  }
}
Пример #24
0
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;
	}
}
Пример #25
0
	}END_TEST

START_TEST(WriteSingleAttributeDescription)
	{
		UA_Server *server = makeTestSequence();

		UA_WriteValue wValue;
		UA_WriteValue_init(&wValue);
		UA_LocalizedText testValue = UA_LOCALIZEDTEXT("en_EN", "the.answer");
		UA_Variant_setScalarCopy(&wValue.value.value, &testValue, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
		wValue.value.hasValue = UA_TRUE;
		wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
		wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
		wValue.attributeId = UA_ATTRIBUTEID_DESCRIPTION;
		wValue.value.hasValue = UA_TRUE;
		UA_StatusCode retval = writeValue(server, &wValue);
		ck_assert_int_eq(retval, UA_STATUSCODE_GOOD);
	}END_TEST
Пример #26
0
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);
}
Пример #27
0
	}END_TEST


START_TEST(WriteSingleAttributeValue)
	{
		UA_Server *server = makeTestSequence();

		UA_WriteValue wValue;
		UA_WriteValue_init(&wValue);
		UA_Variant *myIntegerVariant = UA_Variant_new();
		UA_Int32 myInteger = 20;
		UA_Variant_setScalarCopy(myIntegerVariant, &myInteger,
						&UA_TYPES[UA_TYPES_INT32]);
		wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
		wValue.attributeId = UA_ATTRIBUTEID_VALUE;
		wValue.value.hasValue = UA_TRUE;
		wValue.value.value = *myIntegerVariant;
		UA_StatusCode retval = writeValue(server, &wValue);

		UA_DataValue resp;
		UA_DataValue_init(&resp);
		UA_ReadRequest rReq;
		UA_ReadRequest_init(&rReq);
		rReq.nodesToRead = UA_ReadValueId_new();
		rReq.nodesToReadSize = 1;
		rReq.nodesToRead[0].nodeId = UA_NODEID_STRING(1, "the.answer");
		rReq.nodesToRead[0].attributeId = UA_ATTRIBUTEID_VALUE;

		readValue(server, UA_TIMESTAMPSTORETURN_NEITHER, &rReq.nodesToRead[0],
					&resp);

		ck_assert_int_eq(retval, UA_STATUSCODE_GOOD);
		ck_assert(wValue.value.hasValue);
		const UA_Node *node = UA_NodeStore_get(server->nodestore, &wValue.nodeId);
		ck_assert_int_eq(node->nodeClass, UA_NODECLASS_VARIABLE);
		const UA_VariableNode *vn = (const UA_VariableNode*)node;
		const UA_Variant *oldV = &vn->value.variant.value;
		ck_assert_ptr_eq(&oldV->type->typeId, &wValue.value.value.type->typeId);

		ck_assert_int_eq(20, *(UA_Int32* )resp.value.data);
	}END_TEST
Пример #28
0
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);
		}
	}
}
Пример #29
0
//------------------------------------------------------------------------------
// 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 () );
   }
}
Пример #30
0
//------------------------------------------------------------------------------
// The user has pressed return/enter. (Not write when user enters the widget)
// 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 QEGenericEdit::userReturnPressed()
{
    // 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 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 )
    {
       // Note: getValue is a dispatching hook procedure.
       writeValue( qca, getValue () );
    }
}