Пример #1
0
void Cql2Dnf::_destruct(CQLPredicate& _p){
	if(_p.isSimple()){
		CQLSimplePredicate _sp = _p.getSimplePredicate();
		_operations.append(_convertOpType(_sp.getOperation()));
		_operands.append(_sp.getLeftExpression());
		if((_operations[_operations.size()-1] != CQL_IS_NULL) && (_operations[_operations.size()-1] != CQL_IS_NOT_NULL))
			_operands.append(_sp.getRightExpression());
	}
	else{
		Array<CQLPredicate> _preds = _p.getPredicates();
		Array<BooleanOpType> _boolops = _p.getOperators();
		for(Uint32 i=0;i<_preds.size();i++){
			_destruct(_preds[i]);
			if(_preds[i].getInverted()){
				_operations.append(CQL_NOT);
			}
			if(i > 0){
				if(_boolops[i-1] == AND){
					_operations.append(CQL_AND);
				}
				if(_boolops[i-1] == OR){
                                        _operations.append(CQL_OR);
                                }
			}
		}
	}
}
Пример #2
0
void Cql2Dnf::_strip_ops_operands(CQLPredicate& topLevel)
{
	PEG_METHOD_ENTER(TRC_CQL, "Cql2Dnf::_strip_ops_operands");
	//
	// depth first search for all operations and operands
	// extract operations and operands and store in respective arrays for later processing
	//
	_destruct(topLevel);
	if(topLevel.getInverted()){
        	_operations.append(CQL_NOT);
        }
	PEG_METHOD_EXIT();
}
Пример #3
0
        // --------------------------------------------------------------------
        void _read(scanner_type & in)
        {
            //
            // This method executes from the constructor and also throws
            // exceptions, so take care to reclaim resources (the children) in
            // case an exception occurs.
            //
            try
            {
                //
                // Recursively create all nodes in the tree.
                //
                auto node_count = 0;
                _read(in, node_count);

                //
                // Require the last non-whitespace character, the semicolon.
                //
                in.expect(';');

                //
                // Ensure no more non-whitespace characters are in the stream.
                //
                in.skip_whitespace();
                if (in.is_end_of_data())
                    return;

                throw jade::error()
                    << "expected end of stream but encountered "
                    << " '" << in.read_token() << "'";
            }
            catch (...)
            {
                //
                // Reclaim resources before rethrowing the exception.
                //
                _destruct();
                throw;
            }
        }
Пример #4
0
    //
    // HoverButton::HoverButton()
    //   Create a hover button with a parent, hover and normal
    //   images.
    //
    HoverButton::HoverButton
    (QWidget* parent, const QPixmap& hover, const QPixmap& normal)
        : QPushButton(parent),
          d_lit(false),
          d_hover_ptr(0),
          d_normal_ptr(0)
    {
        try
        {
            d_hover_ptr = new QPixmap(hover);
            d_normal_ptr = new QPixmap(normal);
            setMouseTracking(true);
            setPixmap(*d_normal_ptr);
            setFlat(true);
        }

        catch(...)
        {
            _destruct();
            throw;
        }
    }
Пример #5
0
 Json::~Json() {
     _destruct();
 }
Пример #6
0
 Json &Json::at(const wstring &key) {
     if (!isDict())_destruct("Attempting to access key of non-dict.");
     JBase *pjb = ((JDict *) _jBase)->at(key);
     if (!pjb) _destruct("Dict key overflow.");
     return *pjb->_json;
 }
Пример #7
0
 Json &Json::at(const size_t &index) {
     if (!isArray()) _destruct("Attempting to access index of non-array.");
     JBase *pjb = ((JArray *) _jBase)->at(index);
     if (!pjb) _destruct("Array index overflow.");
     return *pjb->_json;
 }
Пример #8
0
AVIStripeSystem::AVIStripeSystem(const char *szFile) {
	FILE *f = NULL;

	stripe = NULL;

	try {
		char linebuf[512];
		int stripe_cnt, cur;
		int lineno = 2;
		char *s, *t;

		// Type of lines we are trying to parse:
		//
		//	0   i   131072     65536      e:\capture_master.avi
		//	0   v   4194304    1048576   "e:\capture video stripe 1.avi"
		//  -1  v	1048576    524288    "i:\capture video stripe 2.avi"


		f = fopen(szFile, "r");
		if (!f) throw MyError("Couldn't open stripe definition file \"%s\"", szFile);

		if (!get_line(linebuf, sizeof linebuf, f))
				throw MyError("Failure reading first line of stripe def file");

		if (1!=sscanf(linebuf, " %d \n", &stripe_cnt))
			throw MyError("First line of stripe definition file must contain stripe count");

		if (stripe_cnt<=0)
			throw MyError("Invalid number of stripes (%d)", stripe_cnt);

		_construct(stripe_cnt);

		for(cur=0; cur<stripe_cnt; cur++) {
			int iPri, iName;
			long lBuffer, lChunk;
			char cMode[2];
			int match_count;

			if (!get_line(linebuf, sizeof linebuf, f))
				throw MyError("Failure reading stripe definition file");

			match_count = sscanf(linebuf, " %d %1s %ld %ld %n", &iPri, cMode, &lBuffer, &lChunk, &iName);

			if (match_count != 4)
				throw MyError("Stripe definition parse error: line %d", lineno);

			t = s = linebuf + iName;
			if (*s=='"') {
				++s, ++t;
				while(*t && *t!='\n' && *t!='"') ++t;
			} else
				while(*t && *t!='\n' && !isspace((unsigned char)*t)) ++t;

			if (t<=s)
				throw MyError("Stripe definition parse error: line %d -- no stripe filename!", lineno);

			switch(tolower(cMode[0])) {
			case 'm':	cMode[0] = AVIStripe::MODE_MASTER; break;
			case 'i':	cMode[0] = AVIStripe::MODE_INDEX; break;
			case 'v':	cMode[0] = AVIStripe::MODE_VIDEO; break;
			case 'a':	cMode[0] = AVIStripe::MODE_AUDIO; break;
			case 'b':	cMode[0] = AVIStripe::MODE_BOTH; break;
			default:
				throw MyError("Invalid stripe mode '%c'", cMode[0]);
			};

			// Allocate a stripe structure and copy the data into it

			if (!(stripe[cur] = new(t+1-s) AVIStripe))
				throw MyMemoryError();

			*t=0;

			stripe[cur]->lBufferSize = lBuffer;
			stripe[cur]->lChunkSize	= lChunk;
			stripe[cur]->iNameLen	= t+1-s;
			stripe[cur]->cStripeMode	= cMode[0];
			stripe[cur]->scPriority	= (signed char)iPri;
			strcpy(stripe[cur]->szName, s);

			++lineno;
		}
	} catch(...) {
		if (f) fclose(f);
		_destruct();
		throw;
	}
	fclose(f);
}
Пример #9
0
AVIStripeSystem::~AVIStripeSystem() {
	_destruct();
}
Пример #10
0
 //
 // HoverButton::~HoverButton()
 //   Destroy the button with the usual _destruct() call.
 //
 HoverButton::~HoverButton()
 {
     _destruct();
 }
Пример #11
0
 ///
 /// Reclaims resources used by this instance and its children.
 ///
 inline ~basic_newick_node()
 {
     _destruct();
 }