Esempio n. 1
0
File: db.c Progetto: yuyang0/mdb
value_t *createValueFromLongLong(long long v) {
	value_t *val;
	if (v >= LONG_MIN && v <= LONG_MAX) {
		val = createValue(ENCODING_INT, NULL);
		val->ptr = (void*) ((long) v);
	} else {
		val = createValue(ENCODING_RAW, sdsfromlonglong(v));
	}
	return val;
}
Esempio n. 2
0
//Only called on translated expressions
IHqlExpression * addExpressionModifier(IHqlExpression * expr, typemod_t modifier, IInterface * extra)
{
    //Not sure which is best implementation...
#if 1
    return createValue(no_typetransfer, makeModifier(expr->getType(), modifier, LINK(extra)), LINK(expr));
#else
    HqlExprArray args;
    unwindChildren(args, expr);
    return createValue(expr->getOperator(), makeModifier(expr->getType(), modifier, LINK(extra)), args);
#endif
}
Esempio n. 3
0
void CChildDatasetColumnInfo::setColumn(HqlCppTranslator & translator, BuildCtx & ctx, IReferenceSelector * selector, IHqlExpression * _value)
{
    OwnedHqlExpr addressSize = getColumnAddress(translator, ctx, selector, sizetType, 0);
    OwnedHqlExpr addressData = getColumnAddress(translator, ctx, selector, queryType(), sizeof(size32_t));

    OwnedHqlExpr lengthTarget = convertAddressToValue(addressSize, sizetType);

    ITypeInfo * columnType = column->queryType();
    OwnedHqlExpr value = LINK(_value); //ensureExprType(_value, columnType);
    ITypeInfo * valueType = value->queryType();

    assertRecordTypesMatch(valueType, columnType);

    bool assignInline = false;  // canEvaluateInline(value);   // MORE: What is the test
//  bool assignInline = canAssignInline(&ctx, value) && !canEvaluateInline(&ctx, value);
    value.setown(addDatasetLimits(translator, ctx, selector, value));

    IHqlExpression * record = column->queryRecord();
    if (assignInline)
    {
        OwnedHqlExpr inlineSize = getSizetConstant(0);
        checkAssignOk(translator, ctx, selector, inlineSize, sizeof(size32_t));

        //Can only assign inline if we know the maximum length that will be assigned is 0.
        Owned<IHqlCppDatasetBuilder> builder = translator.createInlineDatasetBuilder(record, inlineSize, addressData);
        builder->buildDeclare(ctx);

        translator.buildDatasetAssign(ctx, builder, value);

        CHqlBoundTarget boundTarget;
        boundTarget.length.set(lengthTarget);
        builder->buildFinish(ctx, boundTarget);
    }
    else
    {
        CHqlBoundExpr bound;
        translator.buildDataset(ctx, value, bound, FormatBlockedDataset);
        translator.normalizeBoundExpr(ctx, bound);
        ensureSimpleLength(translator, ctx, bound);

        OwnedHqlExpr length = translator.getBoundLength(bound);
        OwnedHqlExpr size = createValue(no_translated, LINK(sizetType), translator.getBoundSize(bound));
        checkAssignOk(translator, ctx, selector, size, sizeof(size32_t));

        translator.assignBoundToTemp(ctx, lengthTarget, length);
        translator.buildBlockCopy(ctx, addressData, bound);

        //Use the size just calculated for the field
        OwnedHqlExpr sizeOfExpr = createValue(no_sizeof, LINK(sizetType), LINK(selector->queryExpr()));
        OwnedHqlExpr boundSize = translator.getBoundSize(bound);
        OwnedHqlExpr srcSize = adjustValue(boundSize, sizeof(size32_t));
        ctx.associateExpr(sizeOfExpr, srcSize);
    }
}
Esempio n. 4
0
File: db.c Progetto: yuyang0/mdb
value_t *createValueFromStr(void *s, size_t len) {
	long v;
	value_t *val;
	// first we try to encode the string as a long.
	if (len > 21 || !string2l(s, len, &v)) {
		val = createValue(ENCODING_RAW, sdsnewlen(s, len));
	} else {
		val = createValue(ENCODING_INT, NULL);
		val->ptr = (void*) ((long) v);
	}
	return val;
}
// creates a predicate object from an AST parse tree
boost::shared_ptr< Predicate > createPredicate( const TreeIter& it )
{
	std::string op( it->value.begin(), it->value.end() );
	
	if ( it->value.id() == PredicateGrammar::predicateId )
	{
		if ( op == "&&" )
			return boost::shared_ptr< Predicate >( new PredicateAnd( 
				createPredicate( it->children.begin() ), createPredicate( it->children.begin() + 1 ) ) );
		else if ( op == "||" )
			return boost::shared_ptr< Predicate >( new PredicateOr( 
				createPredicate( it->children.begin() ), createPredicate( it->children.begin() + 1 ) ) );
		else
			UBITRACK_THROW( "Bad predicate: " + op );
	}
	else if ( it->value.id() == PredicateGrammar::statementId )
	{
		if ( op == "!" )
			return boost::shared_ptr< Predicate >( new PredicateNot( createPredicate( it->children.begin() ) ) );
		else
			UBITRACK_THROW( "Bad statement: " + op );
	}
	else if ( it->value.id() == PredicateGrammar::compOpId )
	{
		if ( it->children.size() == 2 )
			return boost::shared_ptr< Predicate >( new PredicateCompare( op, 
				createValue( it->children.begin() ), createValue( it->children.begin() + 1 ) ) );

		// hack: spirit prunes empty string constants out of the tree
		if ( it->children.size() == 1 )
			return boost::shared_ptr< Predicate >( new PredicateCompare( op, 
				createValue( it->children.begin() ), 
				boost::shared_ptr< AttributeExpression >( new AttributeExpressionConstant( "" ) ) ) );
		
		UBITRACK_THROW( "Problem with comparison parsing: illegal numer of children" );
	}
	else if ( it->value.id() == PredicateGrammar::predicateFunctionId )
	{
		// parse parameters into vector
		std::vector< boost::shared_ptr< AttributeExpression > > params;
		for ( TreeIter itParam = it->children.begin(); itParam != it->children.end(); itParam++ )
			params.push_back( createValue( itParam ) );

		return boost::shared_ptr< Predicate >( new PredicateFunction( op, params ) );
	}
	else
	{
		UBITRACK_THROW( "bad predicate" );
	}
}
Esempio n. 6
0
IHqlExpression * convertAddressToValue(IHqlExpression * address, ITypeInfo * columnType)
{
    if (isTypePassedByAddress(columnType) && !columnType->isReference())
    {
        Owned<ITypeInfo> refType = makeReferenceModifier(LINK(columnType));
        assertex(address->getOperator() == no_externalcall || refType == address->queryType());
        return createValue(no_implicitcast, LINK(refType), LINK(address));
    }

    Owned<ITypeInfo> pointerType = makePointerType(LINK(columnType));
    assertex(address->getOperator() == no_externalcall || pointerType == address->queryType());
    IHqlExpression * temp = createValue(no_implicitcast, LINK(pointerType), LINK(address));
    return createValue(no_deref, LINK(columnType), temp);
}
Esempio n. 7
0
IHqlExpression * addFilter(IHqlExpression * dataset, IHqlExpression * limitField)
{
    IHqlExpression * lower = createConstant(limitField->queryType()->castFrom(true, (__int64)0));
    lower = createValue(no_colon, lower, createValue(no_stored, createConstant(LOWER_LIMIT_ID)));
    lower = createSymbol(createIdentifierAtom(LOWER_LIMIT_ID), lower, ob_private);
    dataset = createDataset(no_filter, LINK(dataset), createBoolExpr(no_ge, LINK(limitField), lower));

    IHqlExpression * upper = createConstant((int)DISKREAD_PAGE_SIZE);
    upper = createValue(no_colon, upper, createValue(no_stored, createConstant(RECORD_LIMIT_ID)));
    upper = createSymbol(createIdentifierAtom(RECORD_LIMIT_ID), upper, ob_private);
    dataset = createDataset(no_choosen, dataset, upper);
    dataset = createSymbol(createIdentifierAtom("_Filtered_"), dataset, ob_private);
    return dataset;
}
Esempio n. 8
0
DrBase* Foomatic2Loader::createOption( const QMap<QString,QVariant>& m ) const
{
	QString type = m.operator[]( "type" ).toString();
	DrBase *opt = NULL;
	if ( type == "enum" )
	{
		DrListOption *lopt = new DrListOption;
		QVariant a = m.operator[]( "vals_byname" );
		QMap<QString,QVariant>::ConstIterator it = a.mapBegin();
		for ( ; it!=a.mapEnd(); ++it )
		{
			if ( it.data().type() != QVariant::Map )
				continue;
			DrBase *ch = createValue( it.key(), it.data().toMap() );
			if ( ch )
				lopt->addChoice( ch );
		}
		opt = lopt;
	}
	else if ( type == "int" || type == "float" )
	{
		if ( type == "int" )
			opt = new DrIntegerOption;
		else
			opt = new DrFloatOption;
		opt->set( "minval", m.operator[]( "min" ).toString() );
		opt->set( "maxval", m.operator[]( "max" ).toString() );
	}
	else if ( type == "bool" )
	{
		DrBooleanOption *bopt = new DrBooleanOption;
		DrBase *choice;
		// choice 1
		choice = new DrBase;
		choice->setName( "0" );
		choice->set( "text", m.operator[]( "name_false" ).toString() );
		bopt->addChoice( choice );
		choice = new DrBase;
		choice->setName( "1" );
		choice->set( "text", m.operator[]( "name_true" ).toString() );
		bopt->addChoice( choice );
		opt = bopt;
	}
	else if ( type == "string" )
	{
		opt = new DrStringOption;
	}
	if ( opt )
	{
		opt->setName( m.operator[]( "name" ).toString() );
		opt->set( "text", m.operator[]( "comment" ).toString() );
		QString defval = m.operator[]( "default" ).toString();
		if ( !defval.isEmpty() )
		{
			opt->setValueText( defval );
			opt->set( "default", defval );
		}
	}
	return opt;
}
Esempio n. 9
0
IHqlExpression * CChildDatasetColumnInfo::buildSizeOfUnbound(HqlCppTranslator & translator, BuildCtx & ctx, IReferenceSelector * selector)
{
    OwnedHqlExpr addressSize = getColumnAddress(translator, ctx, selector, sizetType, 0);
    OwnedHqlExpr length = convertAddressToValue(addressSize, sizetType);
    OwnedHqlExpr boundSize = translator.getBoundSize(column->queryType(), length, NULL);
    return createValue(no_translated, LINK(sizetType), adjustValue(boundSize, sizeof(size32_t)));
}
Esempio n. 10
0
File: dummy.cpp Progetto: RTS2/rts2
		Dummy (int argc, char **argv):Filterd (argc, argv)
		{
			filterNum = 0;
			filterSleep = 3;
			addOption ('s', "filter_sleep", 1, "how long wait for filter change");

			createValue (filterNames, "filter_names", "filter names (will be parsed)", false, RTS2_VALUE_WRITABLE);
		}
Esempio n. 11
0
XDMFINFORMATION *
XdmfInformationNew(char * key, char * value)
{
  try
  {
    std::string createKey(key);
    std::string createValue(value);
    shared_ptr<XdmfInformation> generatedInfo = XdmfInformation::New(createKey, createValue);
    return (XDMFINFORMATION *)((void *)(new XdmfInformation(*generatedInfo.get())));
  }
  catch (...)
  {
    std::string createKey(key);
    std::string createValue(value);
    shared_ptr<XdmfInformation> generatedInfo = XdmfInformation::New(createKey, createValue);
    return (XDMFINFORMATION *)((void *)(new XdmfInformation(*generatedInfo.get())));
  }
}
Esempio n. 12
0
void CChildLimitedDatasetColumnInfo::setColumnFromBuilder(HqlCppTranslator & translator, BuildCtx & ctx, IReferenceSelector * selector, IHqlCppDatasetBuilder * builder)
{
    CHqlBoundExpr bound;
    builder->buildFinish(ctx, bound);
    if (bound.length)
        bound.length.setown(translator.ensureSimpleTranslatedExpr(ctx, bound.length));

    OwnedHqlExpr size = createValue(no_translated, LINK(sizetType), translator.getBoundSize(bound));
    checkAssignOk(translator, ctx, selector, size, 0);

    OwnedHqlExpr addressData = getColumnAddress(translator, ctx, selector, queryType(), 0);
    translator.buildBlockCopy(ctx, addressData, bound);

    //Use the size just calculated for the field
    OwnedHqlExpr sizeOfExpr = createValue(no_sizeof, LINK(sizetType), LINK(selector->queryExpr()));
    OwnedHqlExpr srcSize = translator.getBoundSize(bound);
    ctx.associateExpr(sizeOfExpr, srcSize);
}
Esempio n. 13
0
void CChildLimitedDatasetColumnInfo::buildDeserializeChildLoop(HqlCppTranslator & translator, BuildCtx & loopctx, IReferenceSelector * selector, IHqlExpression * helper, IAtom * serializeForm)
{
    OwnedHqlExpr mappedCount = replaceSelector(countField, querySelfReference(), selector->queryExpr()->queryChild(0));
    CHqlBoundExpr bound;
    translator.buildTempExpr(loopctx, mappedCount, bound);

    OwnedHqlExpr test = createValue(no_postdec, LINK(bound.expr));
    loopctx.addLoop(test, NULL, false);
}
Esempio n. 14
0
Symbol::Symbol(std::string name, std::string type, bool var)
{
	mName = name;
	mType = type;
	mNode = NULL;
	mVar = var;
	if (mVar)
	{
		createValue();
	}
}
Esempio n. 15
0
void HqlCppCaseInfo::buildChop3Map(BuildCtx & ctx, const CHqlBoundTarget & target, CHqlBoundExpr & test, IHqlExpression * temp, unsigned start, unsigned end)
{
    if ((end - start) <= 2)
        buildChop2Map(ctx, target, test, start, end);
    else
    {
        unsigned mid = start + (end - start) / 2;
        generateCompareVar(ctx, temp, test, queryCompare(mid));
        OwnedHqlExpr test1 = createValue(no_eq, LINK(temp), getZero());
        OwnedHqlExpr test2 = createValue(no_lt, LINK(temp), getZero());

        BuildCtx subctx(ctx);
        IHqlStmt * if1 = subctx.addFilter(test1);                   // if (test == 0)
        translator.buildExprAssign(subctx, target, queryReturn(mid));  //   target = value(n)
        subctx.selectElse(if1);                                                         // else
        IHqlStmt * if2 = subctx.addFilter(test2);                   //   if (test < 0)
        buildChop3Map(subctx, target, test, temp, start, mid);      //       repeat for start..mid
        subctx.selectElse(if2);                                                         //   else
        buildChop3Map(subctx, target, test, temp, mid+1, end);      //       repeat for min..end
    }
}
Esempio n. 16
0
//Optimize IF(a,b,c) op x to IF(a,b op x, c OP x)
//But be careful because it uncommons attributes increasing the size of the queries.
static IHqlExpression * peepholeOptimizeCompare(BuildCtx & ctx, IHqlExpression * expr)
{
    IHqlExpression * lhs = expr->queryChild(0);
    if (ctx.queryMatchExpr(lhs))
        return LINK(expr);

    IHqlExpression * rhs = expr->queryChild(1);
    if (!rhs->isConstant() || (lhs->getOperator() != no_if))
        return LINK(expr);

    IHqlExpression * ifCond = lhs->queryChild(0);
    IHqlExpression * ifTrue = lhs->queryChild(1);
    IHqlExpression * ifFalse = lhs->queryChild(2);
    assertex(ifFalse);

    node_operator op = expr->getOperator();
    OwnedHqlExpr newTrue = createValue(op, makeBoolType(), LINK(ifTrue), LINK(rhs));
    OwnedHqlExpr newFalse = createValue(op, makeBoolType(), LINK(ifFalse), LINK(rhs));
    OwnedHqlExpr newIf = createValue(no_if, makeBoolType(), LINK(ifCond), peepholeOptimize(ctx, newTrue), peepholeOptimize(ctx, newFalse));
    return expr->cloneAllAnnotations(newIf);
}
Esempio n. 17
0
IHqlExpression * addMemberSelector(IHqlExpression * expr, IHqlExpression * selector)
{
    if (!expr)
        return NULL;
    if (expr->getOperator() == no_variable)
        return createValue(no_pselect, expr->getType(), LINK(selector), LINK(expr));
    if (expr->numChildren() == 0)
        return LINK(expr);
    HqlExprArray args;
    ForEachChild(i, expr)
        args.append(*addMemberSelector(expr->queryChild(i), selector));
    return expr->clone(args);
}
Esempio n. 18
0
void cvtIndexListToPairs(HqlExprArray & target, IHqlExpression * from)
{
    unsigned max = from->numChildren();
    unsigned idx;
    target.ensure(max);
    for (idx = 0; idx < max; idx++)
    {
        IHqlExpression * v1 = from->queryChild(idx);
        IHqlExpression * v2 = createConstant(createIntValue(idx+1, LINK(unsignedType)));
        ITypeInfo * type = v2->queryType();
        target.append(* createValue(no_mapto, LINK(type), LINK(v1), v2));
    }
}
Esempio n. 19
0
void cvtInListToPairs(HqlExprArray & target, IHqlExpression * from, bool valueIfMatch)
{
    unsigned max = from->numChildren();
    unsigned idx;
    IHqlExpression * tValue = queryBoolExpr(valueIfMatch);
    ITypeInfo * type = queryBoolType();
    target.ensure(max);
    for (idx = 0; idx < max; idx++)
    {
        IHqlExpression * v1 = from->queryChild(idx);
        target.append(* createValue(no_mapto, LINK(type), LINK(v1), LINK(tValue)));
    }
}
Esempio n. 20
0
bool CChildLimitedDatasetColumnInfo::buildReadAhead(HqlCppTranslator & translator, BuildCtx & ctx, ReadAheadState & state)
{
    try
    {
        OwnedHqlExpr self = container->getRelativeSelf();
        if (sizeField)
        {
            OwnedHqlExpr mappedSize = replaceSelector(sizeField, querySelfReference(), self);
            OwnedHqlExpr replacedSize = quickFullReplaceExpressions(mappedSize, state.requiredValues, state.mappedValues);
            if (containsSelector(replacedSize, queryRootSelf()))
                return false;
            callDeserializerSkipInputSize(translator, ctx, state. helper, replacedSize);
            return true;
        }
        else
        {
            OwnedHqlExpr mappedCount = replaceSelector(countField, querySelfReference(), self);
            OwnedHqlExpr replacedCount = quickFullReplaceExpressions(mappedCount, state.requiredValues, state.mappedValues);
            if (containsSelector(replacedCount, queryRootSelf()))
                return false;
            if (fixedChildSize != UNKNOWN_LENGTH)
            {
                OwnedHqlExpr scaledSize = multiplyValue(replacedCount, fixedChildSize);
                callDeserializerSkipInputSize(translator, ctx, state. helper, scaledSize);
                return true;
            }

            BuildCtx loopctx(ctx);
            CHqlBoundExpr bound;
            translator.buildTempExpr(loopctx, replacedCount, bound);

            OwnedHqlExpr test = createValue(no_postdec, LINK(bound.expr));
            loopctx.addLoop(test, NULL, false);

            StringBuffer prefetcherInstanceName;
            translator.ensureRowPrefetcher(prefetcherInstanceName, ctx, column->queryRecord());
            
            StringBuffer s;
            s.append(prefetcherInstanceName).append("->readAhead(");
            translator.generateExprCpp(s, state.helper).append(");");
            loopctx.addQuoted(s);
            return true;
        }
    }
    catch (IException * e)
    {
        //yuk yuk yuk!!  Couldn't resolve the dataset count/size for some strange reason
        e->Release();
    }
    return false;
}
Esempio n. 21
0
//Initializating the value of the motor
void Automata::initAutomata(){
    if(DEBUG){
        std::cout << "\tDebug: Initializating automata...\n";
    }
                                                    //  DC      STEPPER
    distance[NOPE]          = createValue(new int[2]{   0      ,   0    });
    distance[UP]            = createValue(new int[2]{   0      ,  20    });
    distance[DOWN]          = createValue(new int[2]{   0      , -20    });
    distance[LEFT]          = createValue(new int[2]{ -20      ,   0    });
    distance[RIGHT]         = createValue(new int[2]{  20      ,   0    });
    distance[UP_LEFT]       = createValue(new int[2]{ -10      ,  10    });
    distance[UP_RIGHT]      = createValue(new int[2]{  10      ,  10    });
    distance[DOWN_LEFT]     = createValue(new int[2]{ -10      , -10    });
    distance[DOWN_RIGHT]    = createValue(new int[2]{  10      , -10    });
    if(DEBUG){
        std::cout << "\tDebug: See stepper...\n";
        seeMap();
    }
}
Esempio n. 22
0
std::vector<int> Automata::calcDistance(STATE s1, STATE s2){
    if(DEBUG){
        char buffer[300];
        sprintf(buffer,"\tDebug: Transition S1 = %s -> S2 = %s",convertArrow(s1).c_str(),convertArrow(s2).c_str() );
        logger->write(buffer);
    }
    std::vector<int> v1 = distance[s1];
    std::vector<int> v2 = distance[s2];
    return createValue(
            new int[2]{
                v2[DC] - v1[DC], 
                v2[STEPPER] - v1[STEPPER]
            });
}
Esempio n. 23
0
ElementProperty::ElementProperty(Element *parent, const ustring &name, const ustring &info, DataType type, const ustring &list):
		DataValue(type)
{
	this->parent = parent;
	this->name = name;
	this->info = info;
	this->list = list;
	this->type = type;
	flag = 0;

	lock = false;
	
	defValue = createValue(type);
}
Esempio n. 24
0
//return a linked list called parser
LinkedList* parse(LinkedList* tokens, int* depth){
    LinkedList* stack = createList();
    init(stack);
    ConsCell* current = tokens->head;
    //while we still have tokens to step through
    while(current != NULL){
        // if current is an open paren
        if((*current).car->type == 5){
            (*depth)++;
        }
        // if current is a closed paren
        if((*current).car->type == 6){
            // if the depth has already gone below 0, we don't want to do any of that stuff
            if((*depth) <= 0){
                 (*depth) = (*depth) - 1;
            }
            if((*depth) > 0){
                (*depth) = (*depth) - 1;
                
                LinkedList* child = createList();
                init(child);
                //this would insert the open parenthesis into the parse tree...
                //but we don't want that
                //insert(child, current->car);
                
                // while we are still inside a set of parens, add the contents to the child list
                while(((stack->head)->car)->type != 5){
                    insert(child, (*stack).head->car);
                    pop(stack);
                }
                //This would add the closed parentheses to the parse tree...
                //but we don't want that
               //insert(child, (*stack).head->car); 
                pop(stack);
                Value* childValue = createValue();
                enum TOKEN_TYPE newCellType = consType;
                childValue->type = newCellType;
                childValue->cons = child->head;
                insert(stack,childValue);
            }
            

        }else{
            insert(stack, current->car);
        }
        current = current->cdr;  
    }
    return stack;
}
Esempio n. 25
0
 boost::any Cache::get(IndexReaderPtr reader, EntryPtr key)
 {
     MapEntryAny innerCache;
     boost::any value;
     LuceneObjectPtr readerKey(reader->getFieldCacheKey());
     {
         SyncLock cacheLock(&readerCache);
         innerCache = readerCache.get(readerKey);
         if (!innerCache)
         {
             innerCache = MapEntryAny::newInstance();
             readerCache.put(readerKey, innerCache);
         }
         else if (innerCache.contains(key))
             value = innerCache[key];
         if (VariantUtils::isNull(value))
         {
             value = newLucene<CreationPlaceholder>();
             innerCache.put(key, value);
         }
     }
     if (VariantUtils::typeOf<CreationPlaceholderPtr>(value))
     {
         CreationPlaceholderPtr progress(VariantUtils::get<CreationPlaceholderPtr>(value));
         SyncLock valueLock(progress);
         if (VariantUtils::isNull(progress->value))
         {
             progress->value = createValue(reader, key);
             {
                 SyncLock cacheLock(&readerCache);
                 innerCache.put(key, progress->value);
             }
             
             FieldCachePtr wrapper(_wrapper);
             
             // Only check if key.custom (the parser) is non-null; else, we check twice for a single
             // call to FieldCache.getXXX
             if (!VariantUtils::isNull(key->custom) && wrapper)
             {
                 InfoStreamPtr infoStream(wrapper->getInfoStream());
                 if (infoStream)
                     printNewInsanity(infoStream, progress->value);
             }
         }
         return progress->value;
     }
     return value;
 }
Esempio n. 26
0
ElementProperty::ElementProperty(Element *parent, ConfProperty *prop):DataValue(prop->type) {
	this->parent = parent;
	name = prop->name;
	info = prop->info;
	list = prop->list;
	type = prop->type;
	flag = prop->flags;
	group = prop->group;

	lock = false;

	defValue = createValue(type);

	if(!prop->value.empty())
		initFromText(prop->value, true);
}
Esempio n. 27
0
IHqlExpression * checkCreateConcreteModule(IErrorReceiver * errors, IHqlExpression * expr, const ECLlocation & errpos)
{
    IHqlScope * scope = expr->queryScope();
    if (scope && scope->queryConcreteScope())
    {
        IHqlScope * concrete = scope->queryConcreteScope();
        return LINK(queryExpression(concrete));
    }

    if (expr->getOperator() == no_delayedscope)
    {
        if (expr->queryChild(0)->getOperator() == no_assertconcrete)
            return LINK(expr);
    }

    OwnedHqlExpr check = createValue(no_assertconcrete, expr->getType(), LINK(expr), errpos.createLocationAttr());
    return createDelayedScope(check.getClear());
}
Esempio n. 28
0
std::shared_ptr<headerField> headerFieldFactory::create
	(const string& name, const string& body)
{
	NameMap::const_iterator pos = m_nameMap.find(utility::stringUtils::toLower(name));
	std::shared_ptr<headerField> field = NULL;

	if (pos != m_nameMap.end())
		field = ((*pos).second)();
	else
		field = registerer <headerField, headerField>::creator();

	field->setName(name);
	field->setValue(createValue(name));

	if (body != NULL_STRING)
		field->parse(body);

	return field;
}
Esempio n. 29
0
void CChildSetColumnInfo::buildDeserialize(HqlCppTranslator & translator, BuildCtx & ctx, IReferenceSelector * selector, IHqlExpression * helper, IAtom * serializeForm)
{
    OwnedHqlExpr address = getColumnAddress(translator, ctx, selector, boolType, 0);
    OwnedHqlExpr addressSize = getColumnAddress(translator, ctx, selector, sizetType, sizeof(bool));
    OwnedHqlExpr addressData = getColumnAddress(translator, ctx, selector, queryType(), sizeof(bool)+sizeof(size32_t));

    size32_t sizeExtra = sizeof(bool)+sizeof(size32_t);

    //Read the all flag and the size
    OwnedHqlExpr sizeAllSizet = getSizetConstant(sizeExtra);
    callDeserializeGetN(translator, ctx, helper, sizeAllSizet, address);

    OwnedHqlExpr targetSize = convertAddressToValue(addressSize, sizetType);
    OwnedHqlExpr unboundSize = createTranslated(targetSize);
    checkAssignOk(translator, ctx, selector, unboundSize, sizeExtra);

    callDeserializeGetN(translator, ctx, helper, targetSize, addressData);

    OwnedHqlExpr sizeOfExpr = createValue(no_sizeof, LINK(sizetType), LINK(selector->queryExpr()));
    OwnedHqlExpr srcSize = adjustValue(targetSize, sizeExtra);
    ctx.associateExpr(sizeOfExpr, srcSize);
}
Esempio n. 30
0
void toResultItem::addItem(const QString &title, const QString &value)
{
    if (WidgetPos >= NumWidgets)
    {
        NumWidgets += ALLOC_SIZE;
        Widgets.resize(NumWidgets, 0);
    }
    QString t;
    if (title != "-")
        t = Utils::toTranslateMayby(sqlName(), title);
    QWidget *widget;
    if (!Widgets[WidgetPos])
    {
        widget = createTitle(this);
        Widgets[WidgetPos] = widget;
    }
    else
        widget = ((QLabel *)Widgets[WidgetPos]);

    setTitle(widget, t, value);
    if (ShowTitle)
        widget->show();
    else
        widget->hide();

    WidgetPos++;
    if (!Widgets[WidgetPos])
    {
        widget = createValue(this);
        Widgets[WidgetPos] = widget;
    }
    else
        widget = Widgets[WidgetPos];
    setValue(widget, title, value);

    widget->show();
    WidgetPos++;
}