void GuiSplitContainer::initPersistFields()
{
   addGroup( "Splitter", "Options to configure split panels contained by this control" );
   
      addField( "orientation",   TYPEID< Orientation >(),   Offset( mOrientation, GuiSplitContainer),
         "Whether to split between top and bottom (horizontal) or between left and right (vertical)." );
      addField( "splitterSize",  TypeS32,    Offset( mSplitterSize, GuiSplitContainer),
         "Width of the splitter bar between the two sides.  Default is 2." );
      addField( "splitPoint",    TypePoint2I, Offset( mSplitPoint, GuiSplitContainer),
         "Point on control through which the splitter goes.\n\n"
         "Changed relatively if size of control changes." );
      addField( "fixedPanel",    TYPEID< FixedPanel >(),   Offset( mFixedPanel, GuiSplitContainer),
         "Which (if any) side of the splitter to keep at a fixed size." );
      addField( "fixedSize",     TypeS32,    Offset( mFixedPanelSize, GuiSplitContainer),
         "Width of the fixed panel specified by #fixedPanel (if any)." );
      
   endGroup( "Splitter" );

   Parent::initPersistFields();

   // Copyright (C) 2013 WinterLeaf Entertainment LLC.
   //  @Copyright start

   removeField( "lockControl" );

   removeField( "moveControl" );

   // @Copyright end
}
Пример #2
0
void header::removeAllFields(const string& fieldName)
{
	std::vector <ref <headerField> > fields = findAllFields(fieldName);

	for (unsigned int i = 0 ; i < fields.size() ; ++i)
		removeField(fields[i]);
}
Пример #3
0
void MMSMessage::setType(Type t)
{
    removeField("X-Mms-Message-Type");
    const char *str = mapToString(messageTypes, t);
    if (str)
        addField("X-Mms-Message-Type", str);
}
Пример #4
0
void GroundPlane::initPersistFields()
{
   addGroup( "Plane" );

      addField( "squareSize",    TypeF32,          Offset( mSquareSize, GroundPlane ), "Square size in meters to which %GroundPlane subdivides its geometry." );
      addField( "scaleU",        TypeF32,          Offset( mScaleU, GroundPlane ), "Scale of texture repeat in the U direction." );
      addField( "scaleV",        TypeF32,          Offset( mScaleV, GroundPlane ), "Scale of texture repeat in the V direction." );
      addField( "material",      TypeMaterialName, Offset( mMaterialName, GroundPlane ), "Name of Material used to render %GroundPlane's surface." );

   endGroup( "Plane" );
   
   Parent::initPersistFields();

   removeField( "scale" );
   removeField( "position" );
   removeField( "rotation" );
}
Пример #5
0
void MainWindow::addField()
{
	FieldForm * fieldForm = new FieldForm(this);
	fieldForms << fieldForm;
	connect(fieldForm, SIGNAL(removed()), this, SLOT(removeField()));
	fieldsLayout->addWidget(fieldForm);
	fieldForm->show();
}
Пример #6
0
void WaterPlane::initPersistFields()
{
   addGroup( "WaterPlane" );     

      addProtectedField( "gridSize", TypeS32, Offset( mGridSize, WaterPlane ), &protectedSetGridSize, &defaultProtectedGetFn,
		  "Spacing between vertices in the WaterBlock mesh" );

      addProtectedField( "gridElementSize", TypeF32, Offset( mGridElementSize, WaterPlane ), &protectedSetGridElementSize, &defaultProtectedGetFn,
		  "Duplicate of gridElementSize for backwards compatility");

   endGroup( "WaterPlane" );

   Parent::initPersistFields();

   removeField( "rotation" );
   removeField( "scale" );
}
Пример #7
0
//--------------------------------------------------------------------------
void GuiRectHandles::initPersistFields()
{
   addField("handleRect",     TypeRectF,  Offset(mHandleRect,  GuiRectHandles),     "RectF of handle's box." );
   addField("handleSize",     TypeS32,    Offset(mHandleSize,  GuiRectHandles),     "Size of handles in pixels." );
   addField("useCustomColor", TypeBool,   Offset(mUseCustomColor,  GuiRectHandles), "Use given custom color for handles." );
   addField("handleColor",    TypeColorI, Offset(mHandleColor,  GuiRectHandles),    "Use given custom color for handles." );

   Parent::initPersistFields();

   // Copyright (C) 2013 WinterLeaf Entertainment LLC.
   //  @Copyright start

   removeField( "lockControl" );

   removeField( "moveControl" );

   // @Copyright end
}
Пример #8
0
    /**
     * @brief Union::addField
     * @param name
     * @param typeId
     * @return
     */
    SharedField Union::addField(const QString &name, const Common::ID &typeId)
    {
        auto field = std::make_shared<Field>(name, typeId);

        if (getField(name) != nullptr) removeField(name);
        m_Fields.append(field);

        return field;
    }
Пример #9
0
void ObjectContext::doRemoveField(const Variant &key)
{
    if (key.type() != Variant::stringType) {
        Log::error("Context scope only support string keys");
        return;
    }

    removeField(key.toString());
}
Пример #10
0
bool MakePlan::process(pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud_in, float a, float b, float c, float d, pcl::PointXYZRGB &avrPt)
{
    pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud_filtered_out (new pcl::PointCloud<pcl::PointXYZRGB>);
    pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud_filtered_nan (new pcl::PointCloud<pcl::PointXYZRGB>);
    removeOutliers(cloud_in, cloud_filtered_out);
    removeField(cloud_filtered_out, cloud_filtered_nan);
    bool success = getAveragePoint(cloud_filtered_nan, avrPt);
    return success;
}
Пример #11
0
void PxCloth::initPersistFields()
{
   Parent::initPersistFields();

   addField( "material", TypeMaterialName, Offset( mMaterialName, PxCloth ),
      "@brief Name of the material to render.\n\n" );

   addField( "samples", TypePoint2I, Offset( mPatchVerts, PxCloth ),
      "@brief The number of cloth vertices in width and length.\n\n"
      "At least two verts should be defined.\n\n");

   addField( "size", TypePoint2F, Offset( mPatchSize, PxCloth ),
      "@brief The width and height of the cloth.\n\n" );

   addField( "bending", TypeBool, Offset( mBendingEnabled, PxCloth ),
      "@brief Enables or disables bending resistance.\n\n"
      "Set the bending resistance through PxCloth::bendingStiffness." );

   addField( "damping", TypeBool, Offset( mDampingEnabled, PxCloth ),
      "@brief Enable/disable damping of internal velocities.\n\n" );

   addField( "triangleCollision", TypeBool, Offset( mTriangleCollisionEnabled, PxCloth ),
      "@brief Not supported in current release (according to PhysX docs).\n\n"
	   "Enables or disables collision detection of cloth triangles against the scene. "
	   "If not set, only collisions of cloth particles are detected. If set, "
      "collisions of cloth triangles are detected as well." );

   addField( "selfCollision", TypeBool, Offset( mSelfCollisionEnabled, PxCloth ),
      "@brief Enables or disables self-collision handling within a single piece of cloth.\n\n" );

   addField( "density", TypeF32, Offset( mDensity, PxCloth ),
      "@brief Density of the cloth (Mass per Area).\n\n" );

   addField( "thickness", TypeF32, Offset( mThickness, PxCloth ),
      "@brief Value representing how thick the cloth is.\n\n"
      "The thickness is usually a fraction of the overall extent of the cloth and "
	   "should not be set to a value greater than that. A good value is the maximal "
	   "distance between two adjacent cloth particles in their rest pose. Visual "
	   "artifacts or collision problems may appear if the thickness is too small.\n\n" );

   addField( "friction", TypeF32, Offset( mFriction, PxCloth ),
      "@brief Friction coefficient in the range 0 to 1.\n\n"
	   "Defines the damping of the velocities of cloth particles that are in contact." );

   addField( "bendingStiffness", TypeF32, Offset( mBendingStiffness, PxCloth ),
      "@brief Bending stiffness of the cloth in the range 0 to 1.\n\n" );
   
   addField( "dampingCoefficient", TypeF32, Offset( mDampingCoefficient, PxCloth ),
      "@brief Spring damping of the cloth in the range 0 to 1.\n\n" );

   addField( "attachments", TYPEID< PxClothAttachment >(), Offset( mAttachmentMask, PxCloth ),
      "@brief Optional way to specify cloth verts that will be attached to the world position "
      "it is created at.\n\n" );

   // Cloth doesn't support scale.
   removeField( "scale" );
}
void GuiTextEditSliderCtrl::initPersistFields()
{
   addField("format",    TypeString,  Offset(mFormat, GuiTextEditSliderCtrl), "Character format type to place in the control.\n");
   addField("range",     TypePoint2F, Offset(mRange, GuiTextEditSliderCtrl), "Maximum vertical and horizontal range to allow in the control.\n");
   addField("increment", TypeF32,     Offset(mIncAmount,     GuiTextEditSliderCtrl), "How far to increment the slider on each step.\n");
   addField("focusOnMouseWheel", TypeBool, Offset(mFocusOnMouseWheel, GuiTextEditSliderCtrl), "If true, the control will accept giving focus to the user when the mouse wheel is used.\n");

   Parent::initPersistFields();

   // Copyright (C) 2013 WinterLeaf Entertainment LLC.
   //  @Copyright start

   removeField( "lockControl" );

   removeField( "moveControl" );

   // @Copyright end
}
Пример #13
0
void SubmitFieldWidget::setFields(const QStringList & f)
{
    // remove old fields
    for (int i = d->fieldEntries.size() - 1 ; i >= 0 ; i--)
        removeField(i);

    d->fields = f;
    if (!f.empty())
        createField(f.front());
}
Пример #14
0
const bool Uniforms::removeUniform( const std::string& name )
{
	if ( isAnUniformName(name) )
	{
		removeField(name);
		return true;
	}
	else
	{
		return false;
	}
}
Пример #15
0
//--------------------------------------------------------------------------
void GuiColorPickerCtrl::initPersistFields()
{
   addGroup("ColorPicker");
   
      addField("baseColor", TypeColorF, Offset(mBaseColor, GuiColorPickerCtrl));
      addField("pickColor", TypeColorF, Offset(mPickColor, GuiColorPickerCtrl));
      addField("selectorGap", TypeS32,  Offset(mSelectorGap, GuiColorPickerCtrl)); 
      addField("displayMode", TYPEID< PickMode >(), Offset(mDisplayMode, GuiColorPickerCtrl) );
      addField("actionOnMove", TypeBool,Offset(mActionOnMove, GuiColorPickerCtrl));
      addField("showReticle", TypeBool, Offset(mShowReticle, GuiColorPickerCtrl));
   
   endGroup("ColorPicker");

   Parent::initPersistFields();

   // Copyright (C) 2013 WinterLeaf Entertainment LLC.
   //  @Copyright start

   removeField( "controlFontColor" );

   removeField( "controlFillColor" );

   removeField( "backgroundColor" );

   removeField( "contextFontColor" );

   removeField( "contextBackColor" );

   removeField( "contextFillColor" );

   // @Copyright end
}
Пример #16
0
void GroundPlane::initPersistFields()
{
   addGroup( "Plane" );
   addField( "squareSize",    TypeF32,          Offset( mSquareSize, GroundPlane ) );
   addField( "scaleU",        TypeF32,          Offset( mScaleU, GroundPlane ) );
   addField( "scaleV",        TypeF32,          Offset( mScaleV, GroundPlane ) );
   addField( "material",      TypeMaterialName, Offset( mMaterialName, GroundPlane ) );
   endGroup( "Plane" );
   
   Parent::initPersistFields();

   removeField( "scale" );
}
Пример #17
0
void SubmitFieldWidget::slotRemove()
{
    // Never remove first entry
    const int index = d->findSender(sender());
    switch (index) {
    case -1:
        break;
    case 0:
        d->fieldEntries.front().lineEdit->clear();
        break;
    default:
        removeField(index);
        break;
    }
}
Пример #18
0
//
// NOTE: keep this as consistent as possible with PointLight::initPersistFields()
//
void afxT3DPointLightData::initPersistFields()
{
   addGroup( "Light" );
      
      addField( "radius", TypeF32, Offset( mRadius, afxT3DPointLightData ),
        "Controls the falloff of the light emission");

   endGroup( "Light" );

   // We do the parent fields at the end so that
   // they show up that way in the inspector.
   Parent::initPersistFields();

   // Remove the scale field... it's already 
   // defined by the light radius.
   removeField( "scale" );
}
Пример #19
0
void Uniforms::clearUniforms()
{
	std::vector< std::string > fieldNames;
	getFieldNames(fieldNames);

	for( auto	i		= fieldNames.begin(),
				iEnd	= fieldNames.end();
		i != iEnd;
		++i )
	{
		const std::string& fieldName = *i;
		if ( isAnUniformName(fieldName) )
		{
			// This is the name of an uniform variable, so remove it
			removeField( fieldName );
		}
		// else not a field containing an uniform, so do nothing
	}
}
Пример #20
0
FeatureClassDlg::FeatureClassDlg(QWidget* pParent) :
    QDialog(pParent)
{
    // Classes
    QLabel* pClassLabel = new QLabel("Feature Classes:", this);

    QToolButton* pAddFeatureButton = new QToolButton(this);
    pAddFeatureButton->setAutoRaise(true);
    pAddFeatureButton->setIcon(QIcon(":/icons/New"));
    pAddFeatureButton->setToolTip("Add Feature");

    QToolButton* pRemoveFeatureButton = new QToolButton(this);
    pRemoveFeatureButton->setAutoRaise(true);
    pRemoveFeatureButton->setIcon(QIcon(":/icons/Delete"));
    pRemoveFeatureButton->setToolTip("Remove Feature");

    mpClassList = new QListWidget(this);
    mpClassList->setFixedWidth(150);
    mpClassList->setSelectionMode(QAbstractItemView::SingleSelection);
    mpClassList->setSortingEnabled(true);
    mpClassList->sortItems(Qt::AscendingOrder);

    // Fields
    QLabel* pFieldLabel = new QLabel("Fields:", this);

    QToolButton* pAddFieldButton = new QToolButton(this);
    pAddFieldButton->setAutoRaise(true);
    pAddFieldButton->setIcon(QIcon(":/icons/New"));
    pAddFieldButton->setToolTip("Add Field");

    QToolButton* pRemoveFieldButton = new QToolButton(this);
    pRemoveFieldButton->setAutoRaise(true);
    pRemoveFieldButton->setIcon(QIcon(":/icons/Delete"));
    pRemoveFieldButton->setToolTip("Remove Field");

    QStringList columnNames;
    columnNames.append("Name");
    columnNames.append("Type");
    columnNames.append("Default Value");

    mpFieldTree = new QTreeWidget(this);
    mpFieldTree->setColumnCount(3);
    mpFieldTree->setHeaderLabels(columnNames);
    mpFieldTree->setSelectionMode(QAbstractItemView::SingleSelection);
    mpFieldTree->setRootIsDecorated(false);
    mpFieldTree->setAllColumnsShowFocus(true);
    mpFieldTree->setSortingEnabled(true);
    mpFieldTree->sortByColumn(0, Qt::AscendingOrder);
    mpFieldTree->setItemDelegateForColumn(0, new FieldNameDelegate(mpFieldTree));
    mpFieldTree->setItemDelegateForColumn(1, new FieldTypeDelegate(mpFieldTree));
    mpFieldTree->setItemDelegateForColumn(2, new FieldValueDelegate(mpFieldTree));

    QHeaderView* pHeader = mpFieldTree->header();
    if (pHeader != NULL)
    {
        pHeader->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
        pHeader->setStretchLastSection(false);
        pHeader->setSortIndicatorShown(true);
    }

    // Horizontal line
    QFrame* pLine = new QFrame(this);
    pLine->setFrameStyle(QFrame::HLine | QFrame::Sunken);

    // Dialog buttons
    QDialogButtonBox* pButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
            Qt::Horizontal, this);

    // Layout
    QHBoxLayout* pFeatureButtonLayout = new QHBoxLayout();
    pFeatureButtonLayout->setMargin(0);
    pFeatureButtonLayout->setSpacing(0);
    pFeatureButtonLayout->addWidget(pClassLabel);
    pFeatureButtonLayout->addSpacing(10);
    pFeatureButtonLayout->addStretch();
    pFeatureButtonLayout->addWidget(pAddFeatureButton);
    pFeatureButtonLayout->addWidget(pRemoveFeatureButton);

    QVBoxLayout* pFeatureClassLayout = new QVBoxLayout();
    pFeatureClassLayout->setMargin(0);
    pFeatureClassLayout->setSpacing(2);
    pFeatureClassLayout->addLayout(pFeatureButtonLayout);
    pFeatureClassLayout->addWidget(mpClassList, 10);

    QHBoxLayout* pFieldButtonLayout = new QHBoxLayout();
    pFieldButtonLayout->setMargin(0);
    pFieldButtonLayout->setSpacing(0);
    pFieldButtonLayout->addWidget(pFieldLabel);
    pFieldButtonLayout->addSpacing(10);
    pFieldButtonLayout->addStretch();
    pFieldButtonLayout->addWidget(pAddFieldButton);
    pFieldButtonLayout->addWidget(pRemoveFieldButton);

    QVBoxLayout* pFieldLayout = new QVBoxLayout();
    pFieldLayout->setMargin(0);
    pFieldLayout->setSpacing(2);
    pFieldLayout->addLayout(pFieldButtonLayout);
    pFieldLayout->addWidget(mpFieldTree, 10);

    QGridLayout* pLayout = new QGridLayout(this);
    pLayout->setMargin(10);
    pLayout->setSpacing(10);
    pLayout->addLayout(pFeatureClassLayout, 0, 0);
    pLayout->addLayout(pFieldLayout, 0, 1);
    pLayout->addWidget(pLine, 1, 0, 1, 2);
    pLayout->addWidget(pButtonBox, 2, 0, 1, 2);
    pLayout->setRowStretch(0, 10);
    pLayout->setColumnStretch(1, 10);

    // Initialization
    setWindowTitle("Feature Classes");
    resize(550, 300);
    loadFromSettings();
    updateFields();

    // Connections
    VERIFYNR(connect(pAddFeatureButton, SIGNAL(clicked()), this, SLOT(addFeatureClass())));
    VERIFYNR(connect(pRemoveFeatureButton, SIGNAL(clicked()), this, SLOT(removeFeatureClass())));
    VERIFYNR(connect(mpClassList, SIGNAL(itemChanged(QListWidgetItem*)), this,
                     SLOT(setFeatureClassData(QListWidgetItem*))));
    VERIFYNR(connect(mpClassList, SIGNAL(itemSelectionChanged()), this, SLOT(updateFields())));
    VERIFYNR(connect(pAddFieldButton, SIGNAL(clicked()), this, SLOT(addField())));
    VERIFYNR(connect(pRemoveFieldButton, SIGNAL(clicked()), this, SLOT(removeField())));
    VERIFYNR(connect(mpFieldTree, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this,
                     SLOT(setFieldData(QTreeWidgetItem*, int))));
    VERIFYNR(connect(pButtonBox, SIGNAL(accepted()), this, SLOT(accept())));
    VERIFYNR(connect(pButtonBox, SIGNAL(rejected()), this, SLOT(reject())));
}
Пример #21
0
INT32 countCommand::convertRequest( mongoParser &parser,
                                    std::vector<msgBuffer*> &sdbMsgs )
{
   INT32 rc          = SDB_OK ;
   INT32 nToSkip     = 0 ;
   INT32 nToReturn   = 0 ;
   MsgHeader *header = NULL ;
   MsgOpQuery *query = NULL ;
   bson::BSONObj cond ;
   bson::BSONObj queryObj ;
   bson::BSONObj orderby ;
   bson::BSONObj fields ;
   bson::BSONObjBuilder obj ;
   bson::BSONElement e ;
   const std::string cmdStr = "$get count" ;
   std::string fullname ;
   msgBuffer *sdbMsg = SDB_OSS_NEW msgBuffer() ;
   if ( NULL == sdbMsg )
   {
      rc = SDB_OOM ;
      goto error ;
   }
   parser.opType = OP_CMD_COUNT ;
   sdbMsg->reverse( sizeof ( MsgOpQuery ) ) ;
   sdbMsg->advance( sizeof ( MsgOpQuery ) - 4 ) ;

   header = ( MsgHeader * )sdbMsg->data() ;
   header->opCode = MSG_BS_QUERY_REQ ;
   header->TID = 0 ;
   header->routeID.value = 0 ;
   header->requestID = parser.id ;

   query = ( MsgOpQuery * )sdbMsg->data() ;
   query->version = 0 ;
   query->w = 0 ;
   query->padding = 0 ;
   query->flags = 0 ;

   fullname = parser.csName ;

   query->nameLength = cmdStr.length() ;
   parser.skip( parser.nsLen + 1 ) ;

   parser.readNumber( sizeof( INT32 ), ( CHAR * )&nToSkip ) ;
   parser.readNumber( sizeof( INT32 ), ( CHAR * )&nToReturn ) ;

   if ( parser.more() )
   {
      parser.nextObj( cond ) ;
   }

   fullname += "." ;
   fullname += cond.getStringField( "count" ) ;

   query->nameLength = cmdStr.length() ;
   sdbMsg->write( cmdStr.c_str(), query->nameLength + 1, TRUE ) ;
   obj.append( "Collection", fullname.c_str() ) ;

   queryObj = cond.getObjectField( "query" ) ;
   orderby = queryObj.getObjectField( "sort" ) ;
   queryObj = removeField( queryObj, "sort" ) ;

   nToReturn = cond.getIntField( "limit" ) ;
   nToSkip   = cond.getIntField( "skip" ) ;
   query->numToSkip = nToSkip ;
   query->numToReturn = nToReturn ;

   sdbMsg->write( queryObj, TRUE ) ;
   sdbMsg->write( fields, TRUE ) ;
   sdbMsg->write( orderby, TRUE ) ;
   sdbMsg->write( obj.done(), TRUE ) ;

   header->messageLength = sdbMsg->size() ;
   sdbMsgs.push_back( sdbMsg ) ;

done:
   return rc ;
error:
   goto done ;
}
Пример #22
0
INT32 aggregateCommand::convertRequest( mongoParser &parser,
                                        std::vector<msgBuffer*> &sdbMsgs )
{
   INT32 rc             = SDB_OK ;
   INT32 nToSkip        = 0 ;
   INT32 nToReturn      = 0 ;
   MsgHeader *header    = NULL ;
   MsgOpAggregate *aggr = NULL ;
   bson::BSONObj cond ;
   bson::BSONElement e ;
   std::string fullname ;
   msgBuffer *sdbMsg = SDB_OSS_NEW msgBuffer() ;
   if ( NULL == sdbMsg )
   {
      rc = SDB_OOM ;
      goto error ;
   }

   parser.opType = OP_CMD_AGGREGATE ;
   sdbMsg->reverse( sizeof ( MsgOpAggregate ) ) ;
   sdbMsg->advance( sizeof ( MsgOpAggregate ) - 4 ) ;

   header = ( MsgHeader * )sdbMsg->data() ;
   header->opCode = MSG_BS_AGGREGATE_REQ ;
   header->TID = 0 ;
   header->routeID.value = 0 ;
   header->requestID = parser.id ;

   aggr = ( MsgOpAggregate * )sdbMsg->data() ;
   aggr->version = 0 ;
   aggr->w = 0 ;
   aggr->padding = 0 ;
   aggr->flags = 0 ;

   fullname = parser.csName ;
   parser.skip( parser.nsLen + 1 ) ;

   parser.readNumber( sizeof( INT32 ), ( CHAR * )&nToSkip ) ;
   parser.readNumber( sizeof( INT32 ), ( CHAR * )&nToReturn ) ;

   if ( parser.more() )
   {
      parser.nextObj( cond ) ;
   }

   fullname += "." ;
   fullname += cond.getStringField( "aggregate" ) ;
   cond = removeField( cond, "aggregate" ) ;

   aggr->nameLength = fullname.length() ;
   sdbMsg->write( fullname.c_str(), aggr->nameLength + 1, TRUE ) ;


   sdbMsg->write( cond, TRUE ) ;
   header->messageLength = sdbMsg->size() ;
   sdbMsgs.push_back( sdbMsg ) ;

done:
   return rc ;
error:
   goto done ;
}
Пример #23
0
INT32 updateCommand::convertRequest( mongoParser &parser,
                                     std::vector<msgBuffer*> &sdbMsgs )
{
   INT32 rc            = SDB_OK ;
   INT32 updateFlags   = 0 ;
   MsgHeader *header   = NULL ;
   MsgOpUpdate *update = NULL ;
   bson::BSONObj cond ;
   bson::BSONObj updater ;
   bson::BSONObj hint ;
   msgBuffer *sdbMsg = SDB_OSS_NEW msgBuffer() ;
   if ( NULL == sdbMsg )
   {
      rc = SDB_OOM ;
      goto error ;
   }

   parser.opType = OP_UPDATE ;
   sdbMsg->reverse( sizeof ( MsgOpUpdate ) ) ;
   sdbMsg->advance( sizeof ( MsgOpUpdate ) - 4 ) ;

   header = ( MsgHeader * )sdbMsg->data() ;
   header->opCode = MSG_BS_UPDATE_REQ ;
   header->TID = 0 ;
   header->routeID.value = 0 ;
   header->requestID = parser.id ;

   update = ( MsgOpUpdate * )sdbMsg->data() ;
   update->version = 0 ;
   update->w = 0 ;
   update->padding = 0 ;
   update->flags = 0 ;

   update->nameLength = parser.nsLen ;

   parser.skip( update->nameLength + 1 ) ;
   parser.readNumber( sizeof( INT32 ), (CHAR *)&updateFlags ) ;
   if ( updateFlags & UPDATE_UPSERT )
   {
      update->flags |= FLG_UPDATE_UPSERT ;
   }

   if ( updateFlags & UPDATE_MULTI )
   {
      update->flags |= FLG_UPDATE_MULTIUPDATE ;
   }

   if ( !parser.more() )
   {
      rc = SDB_INVALIDARG ;
      goto error ;
   }
   parser.nextObj( cond ) ;

   if ( !parser.more() )
   {
      rc = SDB_INVALIDARG ;
      goto error ;
   }
   parser.nextObj( updater ) ;

   hint = cond.getObjectField( "$hint" ) ;
   hint = removeField( hint, "$hint" ) ;

   sdbMsg->write( parser.fullName, update->nameLength + 1, TRUE ) ;
   sdbMsg->write( cond, TRUE ) ;
   sdbMsg->write( updater, TRUE ) ;
   sdbMsg->write( hint, TRUE ) ;

   header->messageLength = sdbMsg->size() ;
   sdbMsgs.push_back( sdbMsg ) ;

done:
   return rc ;
error:
   goto done ;
}
Пример #24
0
INT32 queryCommand::convertRequest( mongoParser &parser,
                                    std::vector<msgBuffer*> &sdbMsgs )
{
   INT32 rc           = SDB_OK ;
   INT32 nToSkip      = 0 ;
   INT32 nToReturn    = 0 ;
   MsgHeader *header  = NULL ;
   MsgOpQuery *query  = NULL ;
   const CHAR *cmdStr = NULL ;
   command* cmd       = NULL ;
   bson::BSONObj cond ;
   bson::BSONObj selector ;
   bson::BSONObj orderby ;
   bson::BSONObj hint ;
   bson::BSONObj fieldToReturn ;
   msgBuffer *sdbMsg = SDB_OSS_NEW msgBuffer() ;
   if ( NULL == sdbMsg )
   {
      rc = SDB_OOM ;
      goto error ;
   }

   parser.opType = OP_QUERY ;
   sdbMsg->reverse( sizeof ( MsgOpQuery ) ) ;
   sdbMsg->advance( sizeof ( MsgOpQuery ) - 4 ) ;

   header = ( MsgHeader * )sdbMsg->data() ;
   header->opCode = MSG_BS_QUERY_REQ ;
   header->TID = 0 ;
   header->routeID.value = 0 ;
   header->requestID = parser.id ;

   query = ( MsgOpQuery * )sdbMsg->data() ;
   query->version = 0 ;
   query->w = 0 ;
   query->padding = 0 ;
   query->flags = 0 ;

   query->nameLength = parser.nsLen ;
   parser.skip( query->nameLength + 1 ) ;

   if ( parser.reservedFlags & QUERY_CURSOR_TAILABLE )
   {
   }

   if ( parser.reservedFlags & QUERY_SLAVE_OK )
   {
      query->flags |= FLG_QUERY_SLAVEOK ;
   }

   if ( parser.reservedFlags & QUERY_OPLOG_REPLAY )
   {
      query->flags |= FLG_QUERY_OPLOGREPLAY ;
   }

   if ( parser.reservedFlags & QUERY_NO_CURSOR_TIMEOUT )
   {
      query->flags |= FLG_QUERY_NOCONTEXTTIMEOUT ;
   }

   if ( parser.reservedFlags & QUERY_AWAIT_DATA )
   {
      query->flags |= FLG_QUERY_AWAITDATA ;
   }

   if ( parser.reservedFlags & QUERY_EXHAUST )
   {
   }

   if ( parser.reservedFlags & QUERY_PARTIAL_RESULTS )
   {
      query->flags |= FLG_QUERY_PARTIALREAD ;
   }

   parser.readNumber( sizeof( INT32 ), ( CHAR * )&nToSkip ) ;
   query->numToSkip = nToSkip ;
   parser.readNumber( sizeof( INT32 ), ( CHAR * )&nToReturn ) ;
   query->numToReturn = nToReturn ;

   if ( parser.more() )
   {
      parser.nextObj( cond ) ;
   }

   if ( parser.withCmd )
   {
      cmdStr = cond.firstElementFieldName() ;
      cmd = commandMgr::instance()->findCommand( cmdStr ) ;
      if ( NULL == cmd )
      {
         rc = SDB_OPTION_NOT_SUPPORT ;
         parser.opType = OP_CMD_NOT_SUPPORTED ;
         goto error ;
      }
      parser.reparse() ;
      sdbMsg->zero() ;

      SDB_OSS_DEL sdbMsg ;
      sdbMsg = NULL ;

      rc = cmd->convertRequest( parser, sdbMsgs ) ;
      goto done ;
   }

   orderby = cond.getObjectField( "orderby" ) ;
   orderby = removeField( orderby, "$hint" ) ;

   if ( parser.more() )
   {
      parser.nextObj( fieldToReturn ) ;
   }

   sdbMsg->write( parser.fullName, query->nameLength + 1, TRUE ) ;
   sdbMsg->write( cond, TRUE ) ;
   sdbMsg->write( fieldToReturn, TRUE ) ;
   sdbMsg->write( orderby, TRUE ) ;
   sdbMsg->write( hint, TRUE ) ;

   header->messageLength = sdbMsg->size() ;
   sdbMsgs.push_back( sdbMsg ) ;

done:
   return rc ;
error:
   goto done ;
}
Пример #25
0
INT32 deleteCommand::convertRequest( mongoParser &parser,
                                     std::vector<msgBuffer*> &sdbMsgs )
{
   INT32 rc            = SDB_OK ;
   MsgHeader *header   = NULL ;
   MsgOpDelete *remove = NULL ;
   bson::BSONObj del ;
   bson::BSONObj hint ;

   msgBuffer *sdbMsg = SDB_OSS_NEW msgBuffer() ;
   if ( NULL == sdbMsg )
   {
      rc = SDB_OOM ;
      goto error ;
   }

   parser.opType = OP_REMOVE ;
   sdbMsg->reverse( sizeof ( MsgOpDelete ) ) ;
   sdbMsg->advance( sizeof ( MsgOpDelete ) - 4 ) ;

   header = ( MsgHeader * )sdbMsg->data() ;
   header->opCode = MSG_BS_DELETE_REQ ;
   header->TID = 0 ;
   header->routeID.value = 0 ;
   header->requestID = parser.id ;

   remove = ( MsgOpDelete* )sdbMsg->data() ;
   remove->version = 0 ;
   remove->w = 0 ;
   remove->padding = 0 ;
   remove->flags = 0 ;

   if ( parser.reservedFlags & REMOVE_JUSTONE )
   {
      remove->flags |= FLG_DELETE_SINGLEREMOVE ;
   }

   remove->nameLength = parser.nsLen ;

   parser.skip( remove->nameLength + 1 ) ;
   if ( !parser.more() )
   {
      rc = SDB_INVALIDARG ;
      goto error ;
   }
   parser.nextObj( del ) ;

   if ( parser.more() )
   {
      rc = SDB_INVALIDARG ;
      goto error ;
   }

   hint = del.getObjectField( "$hint" ) ;
   hint = removeField( hint, "$hint" ) ;

   sdbMsg->write( parser.fullName, remove->nameLength + 1, TRUE ) ;
   sdbMsg->write( del, TRUE ) ;
   sdbMsg->write( hint, TRUE ) ;

   header->messageLength = sdbMsg->size() ;
   sdbMsgs.push_back( sdbMsg ) ;

done:
   return rc ;
error:
   goto done ;
}
Пример #26
0
void header::replaceField(ref <headerField> field, ref <headerField> newField)
{
	insertFieldBefore(field, newField);
	removeField(field);
}
Пример #27
0
void MMSMessage::setTxnId(const QString& txnId)
{
    removeField("X-Mms-Transaction-Id");
    addField("X-Mms-Transaction-Id", txnId);
}
Пример #28
0
 /**
  * @brief ComponentsModel::removeField
  * @param field
  * @return
  */
 int ComponentsModel::removeField(const entity::SharedField &field)
 {
     return removeField(index(m_Components->fields().indexOf(field), 0));
 }
Пример #29
0
/*
 *  Constructs a editTableForm as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal dialog.
 */
editTableForm::editTableForm( QWidget* parent, const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "editTableForm" );
    editTableFormLayout = new QGridLayout( this, 1, 1, 11, 6, "editTableFormLayout"); 

    layout50 = new QVBoxLayout( 0, 0, 6, "layout50"); 

    tableLine = new QLineEdit( this, "tableLine" );
    tableLine->setFocusPolicy( QLineEdit::NoFocus );
    tableLine->setReadOnly( TRUE );
    layout50->addWidget( tableLine );

    fieldListView = new QListView( this, "fieldListView" );
    fieldListView->addColumn( tr( "Field name" ) );
    fieldListView->addColumn( tr( "Field type" ) );
    fieldListView->setResizePolicy( QScrollView::Manual );
    fieldListView->setResizeMode( QListView::AllColumns );
    layout50->addWidget( fieldListView );

    editTableFormLayout->addLayout( layout50, 0, 0 );

    layout42 = new QVBoxLayout( 0, 0, 6, "layout42"); 

    renameTableButton = new QPushButton( this, "renameTableButton" );
    layout42->addWidget( renameTableButton );
    QSpacerItem* spacer = new QSpacerItem( 20, 23, QSizePolicy::Minimum, QSizePolicy::Expanding );
    layout42->addItem( spacer );

    renameFieldButton = new QPushButton( this, "renameFieldButton" );
    renameFieldButton->setEnabled( FALSE );
    layout42->addWidget( renameFieldButton );

    removeFieldButton = new QPushButton( this, "removeFieldButton" );
    removeFieldButton->setEnabled( FALSE );
    layout42->addWidget( removeFieldButton );

    addFieldButton = new QPushButton( this, "addFieldButton" );
    layout42->addWidget( addFieldButton );

    editTableFormLayout->addLayout( layout42, 0, 1 );

    layout41 = new QHBoxLayout( 0, 0, 6, "layout41"); 
    QSpacerItem* spacer_2 = new QSpacerItem( 161, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout41->addItem( spacer_2 );

    closeButton = new QPushButton( this, "closeButton" );
    layout41->addWidget( closeButton );

    editTableFormLayout->addMultiCellLayout( layout41, 1, 1, 0, 1 );
    languageChange();
    resize( QSize(428, 266).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( closeButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
    connect( renameTableButton, SIGNAL( clicked() ), this, SLOT( renameTable() ) );
    connect( removeFieldButton, SIGNAL( clicked() ), this, SLOT( removeField() ) );
    connect( addFieldButton, SIGNAL( clicked() ), this, SLOT( addField() ) );
    connect( renameFieldButton, SIGNAL( clicked() ), this, SLOT( editField() ) );
    connect( fieldListView, SIGNAL( selectionChanged() ), this, SLOT( fieldSelectionChanged() ) );
    init();
}