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


C++ ComplexType类代码示例

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


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

示例1: TypeContainer

TypeContainer*
TypeContainer::getAttributeContainer(std::string elemName,
                                     bool create)
{
  TypeContainer *container = 0;
  if ((container = attributeContainers_[elemName]) != 0)
    return container;
  if (!create)
    return container;

  /*
    Create and return a Type Container
  */
  const XSDType *pType = sParser_->getType(typeId_);
  if (pType != 0 && !pType->isSimple())
    {
      ComplexType *cType = (ComplexType *) pType;
      for (int i = 0; i < cType->getNumAttributes(); i++)
        {
          if (cType->getAttributeName(i) == elemName)
            {
              container =
                new TypeContainer(cType->getAttributeType(i), sParser_);
              tcTable.push_back(container);
              break;
            }
        }
    }
  attributeContainers_[elemName] = container;
  return container;
}
开发者ID:mvancompernolle,项目名称:ai_project,代码行数:31,代码来源:TypeContainer.cpp

示例2: parseCompositor

void Parser::parseCompositor( ParserContext *context,
  const QDomElement &element, ComplexType &ct )
{
  QName name = element.tagName();
  bool isChoice = name.localName() == "choice";
  bool isSequence = name.localName() == "sequence";

  Compositor compositor;
  if ( isChoice ) compositor.setType( Compositor::Choice );
  else if ( isSequence ) compositor.setType( Compositor::Sequence );

  if ( isChoice || isSequence ) {
    Element::List newElements;

    QDomElement childElement = element.firstChildElement();

    while ( !childElement.isNull() ) {
      QName csName = childElement.tagName();
      if ( csName.localName() == "element" ) {
        Element newElement;
        if ( isChoice ) {
          newElement = parseElement( context, childElement,
            ct.nameSpace(), element );
        } else {
          if ( isSequence ) {
            // occurence attributes can be either in the
            // parent (sequence) to on the current element
            if ( childElement.hasAttribute("minOccurs") ||
                 childElement.hasAttribute("maxOccurs")) {
              newElement = parseElement( context, childElement,
                ct.nameSpace(), childElement );
            } else {
              newElement = parseElement( context, childElement,
                ct.nameSpace(), element );
            }
          } else {
            newElement = parseElement( context, childElement,
              ct.nameSpace(), childElement );
          }
        }
        newElements.append( newElement );
        compositor.addChild( csName );
      } else if ( csName.localName() == "any" ) {
        addAny( context, childElement, ct );
      } else if ( isChoice ) {
        parseCompositor( context, childElement, ct );
      } else if ( isSequence ) {
        parseCompositor( context, childElement, ct );
      }

      childElement = childElement.nextSiblingElement();
    }

    foreach( Element e, newElements ) {
      e.setCompositor( compositor );
      ct.addElement( e );
    }
开发者ID:cornelius,项目名称:kode,代码行数:57,代码来源:parser.cpp

示例3: temp

void MapEncoder::addKeyDate( UInt16 year, UInt8 month, UInt8 day, MapEntry::MapAction action,
	const ComplexType& value, const EmaBuffer& permissionData )
{
	RsslDate date;
	date.year = year;
	date.month = month;
	date.day = day;

	if ( RSSL_FALSE == rsslDateIsValid( &date ) )
	{
		EmaString temp( "Attempt to specify invalid date. Passed in value is='" );
		temp.append( (UInt32)month ).append( " / " ).
			append( (UInt32)day ).append( " / " ).
			append( (UInt32)year ).append( "'." );
		throwOorException( temp );
		return;
	}

	const Encoder& enc = value.getEncoder();

	UInt8 rsslDataType = enc.convertDataType( value.getDataType() );

	validateEntryKeyAndPayLoad(RSSL_DT_DATE, rsslDataType, value.getDataType(), "addKeyDate()");
	
	if ( action == MapEntry::DeleteEnum )
	{
		addEntryWithNoPayload( &date, action, permissionData, "addKeyDate()" );
	}
	else if ( value.hasEncoder() && enc.ownsIterator() )
	{
		if ( enc.isComplete() )
			addEncodedEntry( &date, action, value, permissionData, "addKeyDate()" );
		else
		{
			EmaString temp( "Attempt to add a ComplexType while complete() was not called on this ComplexType." );
			throwIueException( temp );
			return;
		}
	}
	else if ( value.hasDecoder() )
	{
		addDecodedEntry( &date, action, value, permissionData, "addKeyDate()" );
	}
	else
	{
		if ( rsslDataType == RSSL_DT_MSG )
		{
			EmaString temp( "Attempt to pass in an empty message while it is not supported." );
			throwIueException( temp );
			return;
		}

		passEncIterator( const_cast<Encoder&>( enc ) );
		startEncodingEntry( &date, action, permissionData, "addKeyDate()" );
	}
}
开发者ID:thomsonreuters,项目名称:Elektron-SDK,代码行数:56,代码来源:MapEncoder.cpp

示例4: resolveForwardElementRefs

void TypesTable::resolveForwardElementRefs(const QString &name, Element &element)
{
    for(int i = 0; i < (int)mTypes.count(); i++)
        if(mTypes[i] != 0)
        {
            if(!mTypes[i]->isSimple())
            {
                ComplexType *ct = (ComplexType *)mTypes[i];
                ct->matchElementRef(name, element);
            }
        }
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:12,代码来源:typestable.cpp

示例5: resolveForwardAttributeRefs

void TypesTable::resolveForwardAttributeRefs(const QString &name, Attribute &attribute)
{
    for(int i = 0; i < (int)mTypes.count(); i++)
        if(mTypes[i] != 0)
        {
            if(!mTypes[i]->isSimple())
            {
                ComplexType *ct = (ComplexType *)mTypes[i];
                ct->matchAttributeRef(name, attribute);
            }
        }
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:12,代码来源:typestable.cpp

示例6: set

/// set an element
/// @param i :: The element index
/// @param value :: The new value
void ComplexVector::set(size_t i, const ComplexType &value) {
  if (i < m_vector->size) {
    gsl_vector_complex_set(m_vector, i,
                           gsl_complex{{value.real(), value.imag()}});

  } else {
    std::stringstream errmsg;
    errmsg << "ComplexVector index = " << i
           << " is out of range = " << m_vector->size
           << " in ComplexVector.set()";
    throw std::out_of_range(errmsg.str());
  }
}
开发者ID:DanNixon,项目名称:mantid,代码行数:16,代码来源:ComplexVector.cpp

示例7: validateEntryKeyAndPayLoad

void MapEncoder::addKeyRealFromDouble( double key, MapEntry::MapAction action,
	const ComplexType& value, OmmReal::MagnitudeType magnitudeType, const EmaBuffer& permissionData )
{
	const Encoder& enc = value.getEncoder();

	UInt8 rsslDataType = enc.convertDataType( value.getDataType() );

	validateEntryKeyAndPayLoad(RSSL_DT_REAL, rsslDataType, value.getDataType(), "addKeyRealFromDouble()");

	RsslReal real;
	if ( RSSL_RET_SUCCESS != rsslDoubleToReal( &real, &key, magnitudeType ) )
	{
		EmaString temp( "Attempt to addKeyRealFromDouble() with invalid magnitudeType='" );
		temp.append( getMTypeAsString( magnitudeType) ).append( "'. " );
		throwIueException( temp );
		return;
	}

	if ( action == MapEntry::DeleteEnum )
	{
		addEntryWithNoPayload( &real, action, permissionData, "addKeyRealFromDouble()" );
	}
	else if ( value.hasEncoder() && enc.ownsIterator() )
	{
		if ( enc.isComplete() )
			addEncodedEntry( &real, action, value, permissionData, "addKeyRealFromDouble()" );
		else
		{
			EmaString temp( "Attempt to add a ComplexType while complete() was not called on this ComplexType." );
			throwIueException( temp );
			return;
		}
	}
	else if ( value.hasDecoder() )
	{
		addDecodedEntry( &real, action, value, permissionData, "addKeyRealFromDouble()" );
	}
	else
	{
		if ( rsslDataType == RSSL_DT_MSG )
		{
			EmaString temp( "Attempt to pass in an empty message while it is not supported." );
			throwIueException( temp );
			return;
		}

		passEncIterator( const_cast<Encoder&>( enc ) );
		startEncodingEntry( &real, action, permissionData, "addKeyRealFromDouble()" );
	}
}
开发者ID:thomsonreuters,项目名称:Elektron-SDK,代码行数:50,代码来源:MapEncoder.cpp

示例8: addVariableValue

void NetPlace::addVariableValue(const QString &name, Type * type)
{
	if (type->type() == complex)
	{
		ComplexType * complexType = reinterpret_cast<ComplexType *>(type);
		foreach (QString variable, complexType->variables().keys())
			addVariableValue(name + "." + variable, complexType->variables()[variable]);
	}
	else
	{
		SimpleType * simpleType = reinterpret_cast<SimpleType *>(type);
		m_values.insert(name, simpleType->values());
		m_types.insert(name, simpleType->values().count() > 1 ? array : variable);
	}
}
开发者ID:Romanow,项目名称:petri-nets,代码行数:15,代码来源:state.cpp

示例9: addEncodedEntry

void MapEncoder::addEncodedEntry( void* keyValue, MapEntry::MapAction action, 
	const ComplexType& value, const EmaBuffer& permission, const char* methodName )
{
	rsslClearMapEntry(&_rsslMapEntry);

	_rsslMapEntry.encData = value.getEncoder().getRsslBuffer();

	_rsslMapEntry.action = action;

	encodePermissionData( permission );

	RsslRet retCode = rsslEncodeMapEntry( &_pEncodeIter->_rsslEncIter, &_rsslMapEntry, keyValue );
	while ( retCode == RSSL_RET_BUFFER_TOO_SMALL )
	{
		_pEncodeIter->reallocate();

		retCode = rsslEncodeMapEntry( &_pEncodeIter->_rsslEncIter, &_rsslMapEntry, keyValue );
	}

	if ( retCode < RSSL_RET_SUCCESS )
	{
		EmaString temp( "Failed to " );
		temp.append( methodName ).append( " while encoding Map. Reason='" );
		temp.append( rsslRetCodeToString( retCode ) ).append( "'. " );
		throwIueException( temp );
	}
}
开发者ID:thomsonreuters,项目名称:Elektron-SDK,代码行数:27,代码来源:MapEncoder.cpp

示例10: parseCompositor

void Parser::parseCompositor( ParserContext *context,
  const QDomElement &element, ComplexType &ct )
{
  const QName name( element.tagName() );
  bool isChoice = name.localName() == QLatin1String("choice");
  bool isSequence = name.localName() == QLatin1String("sequence");

  Compositor compositor;
  if ( isChoice ) compositor.setType( Compositor::Choice );
  else if ( isSequence ) compositor.setType( Compositor::Sequence );
  compositor.setMaxOccurs( readMaxOccurs( element ) );

  if ( isChoice || isSequence ) {
    Element::List newElements;
    QDomElement childElement = element.firstChildElement();

    while ( !childElement.isNull() ) {
      NSManager namespaceManager( context, childElement );
      const QName csName( childElement.tagName() );
      if ( csName.localName() == QLatin1String("element") ) {
        Element newElement;
        if ( isChoice ) {
          newElement = parseElement( context, childElement,
            ct.nameSpace(), element );
        } else {
          newElement = parseElement( context, childElement,
            ct.nameSpace(), childElement );
        }
        newElements.append( newElement );
        compositor.addChild( csName );
      } else if ( csName.localName() == QLatin1String("any") ) {
        addAny( context, childElement, ct );
      } else if ( isChoice ) {
        parseCompositor( context, childElement, ct );
      } else if ( isSequence ) {
        parseCompositor( context, childElement, ct );
      }

      childElement = childElement.nextSiblingElement();
    }

    foreach( Element e, newElements ) {
      e.setCompositor( compositor );
      ct.addElement( e );
    }
开发者ID:cjh1,项目名称:KDSoap,代码行数:45,代码来源:parser.cpp

示例11: all

void Parser::all( ParserContext *context, const QDomElement &element, ComplexType &ct )
{
  QDomElement childElement = element.firstChildElement();

  while ( !childElement.isNull() ) {
    QName name = childElement.tagName();
    if ( name.localName() == "element" ) {
      ct.addElement( parseElement( context, childElement, ct.nameSpace(),
        childElement ) );
    } else if ( name.localName() == "annotation" ) {
      Annotation::List annotations = parseAnnotation( context, childElement );
      ct.setDocumentation( annotations.documentation() );
      ct.setAnnotations( annotations );
    }

    childElement = childElement.nextSiblingElement();
  }
}
开发者ID:snichols,项目名称:kode,代码行数:18,代码来源:parser.cpp

示例12: rsslMapApplyHasSummaryData

void MapEncoder::summaryData( const ComplexType& data )
{
	if ( !_containerInitialized )
	{
		const Encoder& enc = data.getEncoder();

		if ( data.hasEncoder() && enc.ownsIterator() )
		{
			if ( enc.isComplete() )
			{
				rsslMapApplyHasSummaryData( &_rsslMap );
				_rsslMap.encSummaryData = enc.getRsslBuffer();
			}
			else
			{
				EmaString temp( "Attempt to set summaryData() with a ComplexType while complete() was not called on this ComplexType." );
				throwIueException( temp );
				return;
			}
		}
		else if ( data.hasDecoder() )
		{
			rsslMapApplyHasSummaryData( &_rsslMap );
			_rsslMap.encSummaryData = const_cast<ComplexType&>(data).getDecoder().getRsslBuffer();
		}
		else
		{
			EmaString temp( "Attempt to pass an empty ComplexType to summaryData() while it is not supported." );
			throwIueException( temp );
			return;
		}

		_emaLoadType = data.getDataType();
		_rsslMap.containerType = enc.convertDataType( _emaLoadType );
	}
	else
	{
		EmaString temp( "Invalid attempt to call summaryData() when container is not empty." );
		throwIueException( temp );
	}
}
开发者ID:thomsonreuters,项目名称:Elektron-SDK,代码行数:41,代码来源:MapEncoder.cpp

示例13: fs

bool LexiconEntry<T>::fromFile(const string &filename)
{ // this does not use boost serialization
    ifstream fs(filename.c_str());
    if(!fs.good())
        return false;
    
    while(fs.good())
    {
        string line;
        getline(fs, line);
        if(line.size())
        {
            ComplexType ct;
            if(!ct.fromString(line))
            {
                cerr << "Error while parsing the complex type \""<<line<<"\""<<endl;
                return false;
            }
            (*this)[ct] = 1.0;
        }
    }
    normalize();    
}
开发者ID:wetneb,项目名称:stocpreg,代码行数:23,代码来源:lexicon.cpp

示例14: acquireEncIterator

void AckMsgEncoder::attrib( const ComplexType& attrib )
{
	acquireEncIterator();

	_rsslAckMsg.msgBase.msgKey.attribContainerType = convertDataType( attrib.getDataType() );

#ifdef __EMA_COPY_ON_SET__
	if ( attrib.hasEncoder() && attrib.getEncoder().ownsIterator() )
	{
		const RsslBuffer& rsslBuf = attrib.getEncoder().getRsslBuffer();
		_attrib.setFrom( rsslBuf.data, rsslBuf.length );
	}
	else if ( attrib.hasDecoder() )
	{
		const RsslBuffer& rsslBuf = const_cast<ComplexType&>( attrib ).getDecoder().getRsslBuffer();
		_attrib.setFrom( rsslBuf.data, rsslBuf.length );
	}
	else
	{
		EmaString temp( "Attempt to pass in an empty ComplexType while it is not supported." );
		throwIueException( temp );
		return;
	}

	_rsslAckMsg.msgBase.msgKey.encAttrib.data = ( char* )_attrib.c_buf();
	_rsslAckMsg.msgBase.msgKey.encAttrib.length = _attrib.length();
#else
	if ( attrib.hasEncoder() && attrib.getEncoder().ownsIterator() )
		_rsslAckMsg.msgBase.msgKey.encAttrib = attrib.getEncoder().getRsslBuffer();
	else if ( attrib.hasDecoder() )
		_rsslAckMsg.msgBase.msgKey.encAttrib = const_cast<ComplexType&>( attrib ).getDecoder().getRsslBuffer();
	else
	{
		EmaString temp( "Attempt to pass in an empty ComplexType while it is not supported." );
		throwIueException( temp );
		return;
	}
#endif

	_rsslAckMsg.msgBase.msgKey.flags |= RSSL_MKF_HAS_ATTRIB;
	_rsslAckMsg.flags |= RSSL_AKMF_HAS_MSG_KEY;
}
开发者ID:lsdxp,项目名称:Elektron-SDK,代码行数:42,代码来源:AckMsgEncoder.cpp

示例15: temp

void SeriesEncoder::add( const ComplexType& complexType )
{
	if ( _containerComplete )
	{
		EmaString temp( "Attempt to add an entry after complete() was called." );
		throwIueException( temp );
		return;
	}

	const Encoder& enc = complexType.getEncoder();

	UInt8 rsslDataType = enc.convertDataType( complexType.getDataType() );

	if ( !hasEncIterator() )
	{
		acquireEncIterator();

		initEncode( rsslDataType, complexType.getDataType() );
	}
	else if ( _rsslSeries.containerType != rsslDataType )
	{
		EmaString temp( "Attempt to add an entry with a different DataType. Passed in ComplexType has DataType of " );
		temp += DataType( complexType.getDataType() ).toString();
		temp += EmaString( " while the expected DataType is " );
		temp += DataType( _emaDataType );
		throwIueException( temp );
		return;
	}

	if ( complexType.hasEncoder() && enc.ownsIterator() )
	{
		if ( enc.isComplete() )
			addEncodedEntry( "add()", enc.getRsslBuffer() );
		else
		{
			EmaString temp( "Attempt to add() a ComplexType while complete() was not called on this ComplexType." );
			throwIueException( temp );
			return;
		}
	}
	else if ( complexType.hasDecoder() )
	{
		addEncodedEntry( "add()", const_cast<ComplexType&>( complexType ).getDecoder().getRsslBuffer() );
	}
	else
	{
		if ( rsslDataType == RSSL_DT_MSG )
		{
			EmaString temp( "Attempt to pass in an empty message while it is not supported." );
			throwIueException( temp );
			return;
		}

		passEncIterator( const_cast<Encoder&>( enc ) );
		startEncodingEntry( "add()" );
	}
}
开发者ID:MandalaLab,项目名称:Elektron-SDK,代码行数:57,代码来源:SeriesEncoder.cpp


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