Exemplo n.º 1
0
 void LimitNode::appendToString(mongoutils::str::stream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "LIMIT\n";
     addIndent(ss, indent + 1);
     *ss << "limit = " << limit << '\n';
     addIndent(ss, indent + 1);
     addCommon(ss, indent);
     addIndent(ss, indent + 1);
     *ss << "Child:" << '\n';
     children[0]->appendToString(ss, indent + 2);
 }
Exemplo n.º 2
0
 void CollectionScanNode::appendToString(mongoutils::str::stream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "COLLSCAN\n";
     addIndent(ss, indent + 1);
     *ss <<  "ns = " << name << '\n';
     if (NULL != filter) {
         addIndent(ss, indent + 1);
         *ss << "filter = " << filter->toString();
     }
     addCommon(ss, indent);
 }
Exemplo n.º 3
0
    //-------------------------------
    void Sampler::add_1_4_1 ( StreamWriter* sw, const String& source ) const
    {
        sw->openElement ( getSamplerTypeString ( mSamplerType ) );

        if ( mSamplerType != Sampler::SAMPLER_TYPE_STATE )
            sw->appendTextElement ( CSWC::CSW_ELEMENT_SOURCE, source );

		addCommon( sw );

        sw->closeElement (); // mSamplerType
    }
Exemplo n.º 4
0
 void GeoNear2DNode::appendToString(stringstream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "GEO_NEAR_2D\n";
     addIndent(ss, indent + 1);
     *ss << "keyPattern = " << indexKeyPattern.toString() << endl;
     addCommon(ss, indent);
     *ss << "nearQuery = " << nq.toString() << endl;
     if (NULL != filter) {
         addIndent(ss, indent + 1);
         *ss << " filter = " << filter->toString();
     }
 }
Exemplo n.º 5
0
 void SortNode::appendToString(stringstream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "SORT\n";
     addIndent(ss, indent + 1);
     *ss << "pattern = " << pattern.toString() << endl;
     addIndent(ss, indent + 1);
     *ss << "query for bounds = " << query.toString() << endl;
     addIndent(ss, indent + 1);
     *ss << "limit = " << limit << endl;
     addCommon(ss, indent);
     *ss << "Child:" << endl;
     children[0]->appendToString(ss, indent + 2);
 }
Exemplo n.º 6
0
 void TextNode::appendToString(stringstream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "TEXT\n";
     addIndent(ss, indent + 1);
     *ss << "numWanted = " << _numWanted << endl;
     addIndent(ss, indent + 1);
     *ss << "keyPattern = " << _indexKeyPattern.toString() << endl;
     addIndent(ss, indent + 1);
     *ss << "query = " << _query << endl;
     addIndent(ss, indent + 1);
     *ss << "language = " << _language << endl;
     addCommon(ss, indent);
 }
Exemplo n.º 7
0
 void AndSortedNode::appendToString(stringstream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "AND_SORTED";
     if (NULL != filter) {
         addIndent(ss, indent + 1);
         *ss << " filter = " << filter->toString() << endl;
     }
     addCommon(ss, indent);
     for (size_t i = 0; i < children.size(); ++i) {
         *ss << "Child " << i << ": ";
         children[i]->appendToString(ss, indent + 1);
     }
 }
Exemplo n.º 8
0
 void GeoNear2DSphereNode::appendToString(mongoutils::str::stream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "GEO_NEAR_2DSPHERE\n";
     addIndent(ss, indent + 1);
     *ss << "keyPattern = " << indexKeyPattern.toString() << '\n';
     addCommon(ss, indent);
     *ss << "baseBounds = " << baseBounds.toString() << '\n';
     addIndent(ss, indent + 1);
     *ss << "nearQuery = " << nq.toString() << '\n';
     if (NULL != filter) {
         addIndent(ss, indent + 1);
         *ss << " filter = " << filter->toString();
     }
 }
Exemplo n.º 9
0
 void AndHashNode::appendToString(mongoutils::str::stream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "AND_HASH\n";
     if (NULL != filter) {
         addIndent(ss, indent + 1);
         *ss << " filter = " << filter->toString() << '\n';
     }
     addCommon(ss, indent);
     for (size_t i = 0; i < children.size(); ++i) {
         addIndent(ss, indent + 1);
         *ss << "Child " << i << ":\n";
         children[i]->appendToString(ss, indent + 1);
     }
 }
Exemplo n.º 10
0
 void MergeSortNode::appendToString(stringstream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "MERGE_SORT\n";
     if (NULL != filter) {
         addIndent(ss, indent + 1);
         *ss << " filter = " << filter->toString() << endl;
     }
     addCommon(ss, indent);
     for (size_t i = 0; i < children.size(); ++i) {
         addIndent(ss, indent + 1);
         *ss << "Child " << i << ":\n";
         children[i]->appendToString(ss, indent + 2);
         *ss << endl;
     }
 }
Exemplo n.º 11
0
 void KeepMutationsNode::appendToString(mongoutils::str::stream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "KEEP_MUTATIONS\n";
     if (NULL != filter) {
         addIndent(ss, indent + 1);
         StringBuilder sb;
         *ss << "filter:\n";
         filter->debugString(sb, indent + 2);
         *ss << sb.str();
     }
     addCommon(ss, indent);
     addIndent(ss, indent + 1);
     *ss << "Child:" << '\n';
     children[0]->appendToString(ss, indent + 2);
 }
Exemplo n.º 12
0
	//-------------------------------
	void Sampler::add_1_5_0 ( StreamWriter* sw ) const
	{
		sw->openElement ( getSamplerTypeString ( mSamplerType ) );

		if ( !mImageId.empty() )
		{
			sw->openElement( CSWC::CSW_ELEMENT_INSTANCE_IMAGE );
			sw->appendAttribute( CSWC::CSW_ATTRIBUTE_URL, "#" + mImageId );
			sw->closeElement (); // CSW_ELEMENT_INSTANCE_IMAGE
		}

		addCommon( sw );
		
		sw->closeElement (); // mSamplerType
	}
Exemplo n.º 13
0
 void IndexScanNode::appendToString(mongoutils::str::stream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "IXSCAN\n";
     addIndent(ss, indent + 1);
     *ss << "keyPattern = " << indexKeyPattern << '\n';
     if (NULL != filter) {
         addIndent(ss, indent + 1);
         *ss << "filter = " << filter->toString();
     }
     addIndent(ss, indent + 1);
     *ss << "direction = " << direction << '\n';
     addIndent(ss, indent + 1);
     *ss << "bounds = " << bounds.toString() << '\n';
     addCommon(ss, indent);
 }
Exemplo n.º 14
0
 void FetchNode::appendToString(stringstream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "FETCH\n";
     if (NULL != filter) {
         addIndent(ss, indent + 1);
         StringBuilder sb;
         *ss << "filter:\n";
         filter->debugString(sb, indent + 2);
         *ss << sb.str();
     }
     addCommon(ss, indent);
     addIndent(ss, indent + 1);
     *ss << "Child:" << endl;
     children[0]->appendToString(ss, indent + 2);
 }
Exemplo n.º 15
0
 void ShardingFilterNode::appendToString(stringstream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "SHARDING_FILTER\n";
     if (NULL != filter) {
         addIndent(ss, indent + 1);
         StringBuilder sb;
         *ss << "filter:\n";
         filter->debugString(sb, indent + 2);
         *ss << sb.str();
     }
     addCommon(ss, indent);
     addIndent(ss, indent + 1);
     *ss << "Child:" << endl;
     children[0]->appendToString(ss, indent + 2);
 }
Exemplo n.º 16
0
 void TextNode::appendToString(mongoutils::str::stream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "TEXT\n";
     addIndent(ss, indent + 1);
     *ss << "keyPattern = " << indexKeyPattern.toString() << '\n';
     addIndent(ss, indent + 1);
     *ss << "query = " << query << '\n';
     addIndent(ss, indent + 1);
     *ss << "language = " << language << '\n';
     addIndent(ss, indent + 1);
     *ss << "indexPrefix = " << indexPrefix.toString() << '\n';
     if (NULL != filter) {
         addIndent(ss, indent + 1);
         *ss << " filter = " << filter->toString();
     }
     addCommon(ss, indent);
 }
Exemplo n.º 17
0
 void IndexScanNode::appendToString(stringstream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "IXSCAN\n";
     addIndent(ss, indent + 1);
     *ss << "keyPattern = " << indexKeyPattern << endl;
     if (NULL != filter) {
         addIndent(ss, indent + 1);
         *ss << " filter= " << filter->toString() << endl;
     }
     addIndent(ss, indent + 1);
     *ss << "direction = " << direction << endl;
     addIndent(ss, indent + 1);
     *ss << "bounds = " << bounds.toString() << endl;
     addIndent(ss, indent + 1);
     *ss << "fetched = " << fetched() << endl;
     addCommon(ss, indent);
 }
Exemplo n.º 18
0
 void ProjectionNode::appendToString(mongoutils::str::stream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "PROJ\n";
     addIndent(ss, indent + 1);
     *ss << "proj = " << projection.toString() << '\n';
     addIndent(ss, indent + 1);
     if (DEFAULT == projType) {
         *ss << "type = DEFAULT\n";
     }
     else if (COVERED_ONE_INDEX == projType) {
         *ss << "type = COVERED_ONE_INDEX\n";
     }
     else {
         invariant(SIMPLE_DOC == projType);
         *ss << "type = SIMPLE_DOC\n";
     }
     addCommon(ss, indent);
     addIndent(ss, indent + 1);
     *ss << "Child:" << '\n';
     children[0]->appendToString(ss, indent + 2);
 }
Exemplo n.º 19
0
    OptionalEntity ComponentsMaker::makeProperty(const Tokens &tokens)
    {
        Q_ASSERT(!tokens.isEmpty() && tokens[int(PropGroupNames::Type)]->isSingle() &&
                 !tokens[int(PropGroupNames::Type)]->token().isEmpty() &&
                 tokens[int(PropGroupNames::Name)]->isSingle() &&
                 !tokens[int(PropGroupNames::Name)]->token().isEmpty());

        Q_ASSERT(checkCommonState());

        entity::SharedProperty newProperty = std::make_shared<entity::Property>();
        newProperty->setTypeSearcher(m_Model->globalDatabase());

        // Add name
        newProperty->setName(tokens[int(PropGroupNames::Name)]->token());

        // Add type
        // Not support namespaces for now, so check only in global database.
        // Work with namespaces and custom types in project will be hard due to Qt meta-stuff.
        // And also required more detail work on current code generation functionality. TODO: implement!
        const entity::SharedScope &globasScope = m_Model->globalDatabase()->scope(common::ID::globalScopeID());
        if (!globasScope)
            return {tr("Cannot find global scope."), nullptr};

        const auto &typeName = tokens[int(PropGroupNames::Type)]->token();
        auto type = globasScope->type(typeName);
        if (!type)
            return {tr("Wrong type: %1.").arg(typeName), nullptr};
        newProperty->setTypeId(type->id());

        // Member (supports only "m_" prefix for now)
        const auto &member = tokens[int(PropGroupNames::Member)]->token();
        if (!member.isEmpty()) {
            const bool hasPrefix = member.startsWith("m_");
            const auto name(hasPrefix ? QString(member).remove(0, 2) : member);
            const auto prefix(hasPrefix ? "m_" : "");
            newProperty->addField(name).field()->setPrefix(prefix);
            newProperty->setMember(true);
        }

        // Common methods
        addCommon(tokens, PropGroupNames::Getter,   &entity::Property::addGetter,   newProperty);
        addCommon(tokens, PropGroupNames::Setter,   &entity::Property::addSetter,   newProperty);
        addCommon(tokens, PropGroupNames::Resetter, &entity::Property::addResetter, newProperty);
        addCommon(tokens, PropGroupNames::Notifier, &entity::Property::addNotifier, newProperty);

        // Revision
        Q_ASSERT(tokens[int(PropGroupNames::Revision)]->isSingle());
        const auto &revision = tokens[int(PropGroupNames::Revision)]->token();
        if (!revision.isEmpty()) {
            bool ok = false;
            int rev = revision.toInt(&ok);

            if (ok)
                newProperty->setRevision(rev);
            else
                return {tr("Wrong revision: %1.").arg(revision), nullptr};
        }

        // Add designable and scriptable
        addDS(tokens, PropGroupNames::Designable, &entity::Property::addDesignableGetter,
              &entity::Property::setDesignable, newProperty);
        addDS(tokens, PropGroupNames::Scriptable, &entity::Property::addScriptableGetter,
              &entity::Property::setScriptable, newProperty);

        // Add stroed, user, const and final options
        addExtra(tokens, PropGroupNames::Stored,   &entity::Property::setStored,   newProperty);
        addExtra(tokens, PropGroupNames::User,     &entity::Property::setUser,     newProperty);
        addExtra(tokens, PropGroupNames::Constant, &entity::Property::setConstant, newProperty);
        addExtra(tokens, PropGroupNames::Final,    &entity::Property::setFinal,    newProperty);

        return {"", newProperty};
    }