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


C++ SbName::getString方法代码示例

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


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

示例1: setClassName

void
SoUnknownEngine::copyContents(const SoFieldContainer *fromFC,
			      SbBool copyConnections)
//
////////////////////////////////////////////////////////////////////////
{
    // Make sure the copy has the correct class name
    const SoUnknownEngine *fromUnk = (const SoUnknownEngine *) fromFC;
    setClassName(fromUnk->className);

    // For each input in the original engine, create a new input and add
    // it to the new engine

    // NOTE: We can't use SoEngine::copyContents() to copy the field
    // data, since that uses SoFieldData::overlay(), which assumes the
    // fields have the same offsets in both engines. Instead, we just
    // copy the field values ourselves.

    const SoFieldData *fromData = fromUnk->getFieldData();
    SoFieldData  *toData	= (SoFieldData *) getFieldData();
    int i;
    for (i = 0; i < fromData->getNumFields(); i++) {

	SoField      *fromField	= fromData->getField(fromUnk, i);
        const SbName fieldName	= fromData->getFieldName(i);
        SoType       fieldType	= fromField->getTypeId();
        SoField      *toField	= (SoField *) (fieldType.createInstance());

        toField->enableNotify(FALSE);
        toField->setContainer(this);
        toField->setDefault(TRUE);
        toField->enableNotify(TRUE);

        toData->addField(this, fieldName.getString(), toField);

	toField->setContainer(this);
	toField->copyFrom(*fromField);
	toField->setIgnored(fromField->isIgnored());
	toField->setDefault(fromField->isDefault());
	toField->fixCopy(copyConnections);
	if (fromField->isConnected() && copyConnections)
	    toField->copyConnection(fromField);
    }

    // Copy the outputs
    SoEngineOutputData *toOutData = (SoEngineOutputData *) getOutputData();

    SoEngineOutputList outList;
    fromUnk->getOutputs(outList);

    for(i = 0; i < outList.getLength(); i++) {
        SoEngineOutput *newOut = new SoEngineOutput;
        const SoType outType = outList[i]->getConnectionType();
	SbName outName;
        getOutputName( outList[i], outName );
	toOutData->addOutput(this, outName.getString(), newOut, outType);
	newOut->setContainer(this);
    }
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:59,代码来源:SoUnknownEngine.cpp

示例2: assert

static SbBool
soupgrader_exists(const SbName & name)
{
  assert(soupgrader_namedict);
  void * dummy;
  return soupgrader_namedict->get(name.getString(), dummy);
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:7,代码来源:SoUpgrader.cpp

示例3: createEditor

QWidget* ParametersDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem& option, const QModelIndex &index) const
{
	const ParametersModel* model = static_cast< const ParametersModel* >( index.model() );
	SoField* field = model->ModelItem( index )->GetField();
	
	if( field->getTypeId().isDerivedFrom( SoSFEnum::getClassTypeId() ) )
	{
		QComboBox* editor = new QComboBox( parent );
		SoSFEnum* enumField = static_cast< SoSFEnum* >( field );
		for( int i = 0; i < enumField->getNumEnums() ; ++i )
		{
			SbName enumName;
			enumField->getEnum( i , enumName );
			editor->addItem( enumName.getString() );
		}
		return editor;
	}
	else if( field->getTypeId().isDerivedFrom( SoMField::getClassTypeId() ) )
	{
		ContainerEditor* editor = new ContainerEditor( parent );
	     editor->setGeometry(option.rect);

	     connect( editor, SIGNAL( editingFinished( )  ), this, SLOT( CloseEditor() ));
		return editor;
	}

	else
	{
		QLineEdit* editor = new QLineEdit(parent);
		return editor;
	}
}
开发者ID:karaul,项目名称:tonatiuh,代码行数:32,代码来源:ParametersDelegate.cpp

示例4: readValue

SbBool SoXipSFData::readValue(SoInput *in)
{
	SbName name;
	if( in->read( name ) )
	{
		if( name == "NULL" || name == "DATA" || name == "\"NULL\"" || name == "\"DATA\"" )
		{
			setVal( NULL );
			SbXipDirtyFieldList::append(this);
			return TRUE;
		}
		else
			in->putBack( name.getString() );
	}

	SoBase* base;
	if( !SoBase::read( in, base, SoXipData::getClassTypeId() ) )
	{
		setVal( NULL );
		return FALSE;
	}

	setVal( NULL );
	SbXipDirtyFieldList::append(this);
	return TRUE;
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:26,代码来源:SoXipSFData.cpp

示例5: s

void
SoSFEnum::writeValue(SoOutput * out) const
{
  const SbName *enumname;
  if (findEnumName(this->getValue(), enumname)) {
    out->write(const_cast<char *>(enumname->getString()));
    return;
  }
  // If we don't have any legal values for this field,
  // pass through read integer values.
  if (!this->legalValuesSet) {
    out->write(this->getValue());
    return;
  }

#if COIN_DEBUG
  // An unknown enumeration value will usually be an indication of a
  // more serious bug, so we elaborate a bit on the error to aid early
  // debugging.  mortene.

  SbName name;
  const SoFieldContainer * thecontainer = this->getContainer();
  const SbBool fname = thecontainer && thecontainer->getFieldName(this, name);
  SbString s("");
  if (fname) { s.sprintf(" \"%s\"", name.getString()); }

  SoDebugError::post("SoSFEnum::writeValue",
                     "Illegal enumeration value %d in field%s",
                     this->getValue(), s.getString());
#endif // COIN_DEBUG
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:31,代码来源:SoSFEnum.cpp

示例6: setVal

SbBool
SoSFPath::readValue(SoInput *in)
//
////////////////////////////////////////////////////////////////////////
{
    SbName	name;
    SoBase	*base;

    // See if it's a null pointer
    if (in->read(name)) {
	if (name == "NULL") {
	    setVal(NULL);
	    return TRUE;
	}
	else
	    in->putBack(name.getString());
    }

    // Read path
    if (! SoBase::read(in, base, SoPath::getClassTypeId())) {
	setVal(NULL);
	return FALSE;
    }

    setVal((SoPath *) base);

    return TRUE;
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:28,代码来源:SoSFPath.cpp

示例7: if

/*!
  Action method for SoWriteAction.

  Writes out a node object, and any connected nodes, engines etc, if
  necessary.
*/
void
SoNode::write(SoWriteAction * action)
{
  SoOutput * out = action->getOutput();

  SoNode * node = this;

  SoProtoInstance * proto = SoProtoInstance::findProtoInstance(this);
  if (proto) { node = proto; }

  if (out->getStage() == SoOutput::COUNT_REFS) {
    node->addWriteReference(out, FALSE);
  }
  else if (out->getStage() == SoOutput::WRITE) {
    if (node->writeHeader(out, FALSE, FALSE)) return;

    // check for special case where we actually have to write out an
    // SoEngineOutput "field". An engine output might be connected via
    // an IS reference in a PROTO, and we then need to write back this
    // IS reference when exporting the VRML file.
    SoProto * proto = out->getCurrentProto();
    if (proto && node->isOfType(SoNodeEngine::getClassTypeId())) {
      SoEngineOutputList l;
      const int num = ((SoNodeEngine*)node)->getOutputs(l);

      for (int i = 0; i < num; i++) {
        SbName name;
        if (((SoNodeEngine*)node)->getOutputName(l[i], name)) {
          SbName pname = proto->findISReference(node, name);
          if (pname.getLength()) {
            out->indent();
            out->write(name.getString());
            out->write(" IS ");
            out->write(pname.getString());
            out->write("\n");
          }
        }
      }
    }
    node->getFieldData()->write(out, node);
    node->writeFooter(out);
  }
  else assert(0 && "unknown stage");
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:50,代码来源:SoNode.cpp

示例8: assert

/*!
  Registers a concrete SoForeignFileKit subtype to be a handler for files with the given extension.
  One class can be a handler for multiple filename extensions.
  
  FIXME: \e identify is not implemented
 */
SbBool
SoForeignFileKit::registerFileExtension(SoType handler, SbName extension, SoForeignFileIdentifyFunc * COIN_UNUSED_ARG(identify))
{
  assert(SoForeignFileKitP::fileexts != NULL);
  assert(handler.canCreateInstance());

  if (extension.getString()[0] == '.') {
#if COIN_DEBUG
    SoDebugError::post("SoForeignFileKit::registerFileExtension",
                       "Do not include the extension separator '.' "
                       "when registering file extension.");
#endif // COIN_DEBUG
  }

  if (SoForeignFileKitP::fileexts->put(extension.getString(), handler)) {
    return TRUE;
  }
  return FALSE;
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:25,代码来源:SoForeignFileKit.cpp

示例9: list_enums

void list_enums(const Type * f)
{
  const unsigned int nrenums = f->getNumEnums();
  for (unsigned int k=0; k < nrenums; k++) {
    SbName name;
    const int val = f->getEnum(k, name);
    (void)fprintf(stdout, "    %s == %d\n",
                  name.getString(), val);
  }
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:10,代码来源:dumpnodes.cpp

示例10:

/*!
  This method removes class type from the class system.
  Returns FALSE if a type with the given name doesn't exist.

  \since Coin 3.0
*/
SbBool
SoType::removeType(const SbName & name)
{
  int16_t index = 0;
  if (!type_dict->get(name.getString(), index)) {
    SoDebugError::post("SoType::removeType",
                       "type with name ``%s'' not found",
                       name.getString());
    return FALSE;
  }

  type_dict->erase(name.getString());
  SoTypeData *typedata = (*SoType::typedatalist)[index];
  (*SoType::typedatalist)[index] = NULL;
  delete typedata;

#if COIN_DEBUG && 0 // debug
  SoDebugError::postInfo("SoType::removeType", "%s", name.getString());
#endif // debug

  return TRUE;
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:28,代码来源:SoType.cpp

示例11:

/*!
  Set the value of this field by specifying an enumeration string value.
*/
void
SoSFEnum::setValue(const SbName name)
{
  int val;
  if (this->findEnumValue(name, val)) {
    this->setValue(val);
  }
  else {
#if COIN_DEBUG
    SoDebugError::post("SoSFEnum::setValue",
                       "Unknown enum '%s'", name.getString());
#endif // COIN_DEBUG
  }
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:17,代码来源:SoSFEnum.cpp

示例12: fromName

const SoType
SoType::createType(const SoType parent, const SbName name,
                   const instantiationMethod method,
                   const uint16_t data)
{
#if COIN_DEBUG
  // We don't use SoType::fromName() to test if a type with this name
  // already exists to avoid loading extension nodes in this context.
  // You should be able to "override" dynamically loadable nodes in program
  // code.
  // FIXME: We ought to factor out and expose this functionality - testing
  // if a class type is already loaded and registered - in the public API.
  // 20040831 larsa  (ref could-have-been-used-to-fix-upgrader-slowness-bug)
  int16_t discard;
  if (type_dict->get(name.getString(), discard)) {
    SoDebugError::post("SoType::createType",
                       "a type with name ``%s'' already created",
                       name.getString());
    return SoType::fromName(name.getString());
  }
#endif // COIN_DEBUG

#if COIN_DEBUG && 0 // debug
  SoDebugError::postInfo("SoType::createType", "%s", name.getString());
#endif // debug

  SoType newType;
  newType.index = SoType::typedatalist->getLength();
  SoTypeData * typeData = new SoTypeData(name, newType, TRUE, data, parent, method);
  SoType::typedatalist->append(typeData);

  // add to dictionary for fast lookup
  type_dict->put(name.getString(), newType.getKey());

  return newType;
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:36,代码来源:SoType.cpp

示例13:

void
SoSFEnum::setValue(const SbName &name)
//
////////////////////////////////////////////////////////////////////////
{
    int	enumVal;

    if (findEnumValue(name, enumVal))
	setValue(enumVal);

#ifdef DEBUG
    else
	SoDebugError::post("SoSFEnum::setValue",
			   "No enum for name \"%s\"", name.getString());
#endif /* DEBUG */
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:16,代码来源:SoSFEnum.cpp

示例14: if

int
main(void)
{
  SoDB::init();
  SoNodeKit::init();
  SoInteraction::init();

  SoTypeList tl;
  const unsigned int n = SoType::getAllDerivedFrom(SoNode::getClassTypeId(), tl);
  for (unsigned int i=0; i < n; i++) {
    (void)fprintf(stdout, "%s", tl[i].getName().getString());

    SoFieldContainer * fc = (SoFieldContainer *)
      (tl[i].canCreateInstance() ? tl[i].createInstance() : NULL);

    if (fc == NULL) {
      (void)fprintf(stdout, "  (abstract)\n");
      continue;
    }

    (void)fprintf(stdout, "\n");

    SoFieldList fl;
    const unsigned int nrf = fc->getAllFields(fl);
    for (unsigned int j=0; j < nrf; j++) {
      SoField * f = fl[j];
      SoType ftype = f->getTypeId();
      SbName fname;
      f->getContainer()->getFieldName(f, fname);
      (void)fprintf(stdout, "  %s (%s)\n",
                    fname.getString(),
                    ftype.getName().getString());

      if (ftype.isDerivedFrom(SoSFEnum::getClassTypeId())) {
        list_enums((SoSFEnum *)f);
      }
      else if (ftype.isDerivedFrom(SoMFEnum::getClassTypeId())) {
        list_enums((SoMFEnum *)f);
      }
    }
  }

  return 0;
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:44,代码来源:dumpnodes.cpp

示例15: field

// Read boolean value from input stream, return TRUE if
// successful. Used from SoSFBool and SoMFBool.
SbBool
sosfbool_read_value(SoInput * in, SbBool & val)
{
  // accept 0 or 1
  if (in->read(val)) {
    if (val != 0 && val != 1) {
      SoReadError::post(in, "Illegal value for field: %d (must be 0 or 1)",
                        val);
      return FALSE;
    }
    return TRUE;
  }

  if (in->isBinary()) {
    SoReadError::post(in, "Premature end of file");
    return FALSE;
  }

  // read TRUE/FALSE keyword

  SbName n;
  if (!in->read(n, TRUE)) {
    SoReadError::post(in, "Couldn't read field value");
    return FALSE;
  }

  if (n == "TRUE") {
    val = TRUE;
    return TRUE;
  }

  if (n == "FALSE") {
    val = FALSE;
    return TRUE;
  }

  SoReadError::post(in,
                    "Invalid value \"%s\" for field (must be TRUE or FALSE)",
                    n.getString());
  return FALSE;
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:43,代码来源:shared.cpp


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