本文整理汇总了C++中AbstractQoreNode类的典型用法代码示例。如果您正苦于以下问题:C++ AbstractQoreNode类的具体用法?C++ AbstractQoreNode怎么用?C++ AbstractQoreNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AbstractQoreNode类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lvi
int SwitchStatement::execImpl(QoreValue& return_value, ExceptionSink *xsink) {
int rc = 0;
// instantiate local variables
LVListInstantiator lvi(lvars, xsink);
AbstractQoreNode *se = sexp->eval(xsink);
if (!xsink->isEvent()) {
// find match
CaseNode *w = head;
while (w) {
if (w->matches(se, xsink))
break;
w = w->next;
}
if (!w && deflt)
w = deflt;
while (w && !rc && !xsink->isEvent()) {
if (w->code)
rc = w->code->execImpl(return_value, xsink);
w = w->next;
}
if (rc == RC_BREAK || rc == RC_CONTINUE)
rc = 0;
}
if (se)
se->deref(xsink);
return rc;
}
示例2: pathstr
QoreHashNode* qore_httpclient_priv::sendMessageAndGetResponse(const char* meth, const char* mpath, const QoreHashNode& nh, const void* data, unsigned size, const ResolvedCallReferenceNode* send_callback, QoreHashNode* info, bool with_connect, int timeout_ms, int& code, bool& aborted, ExceptionSink* xsink) {
QoreString pathstr(msock->socket->getEncoding());
const char* msgpath = with_connect ? mpath : getMsgPath(mpath, pathstr);
if (!connected) {
if (persistent) {
xsink->raiseException("PERSISTENCE-ERROR", "the current connection has been temporarily marked as persistent, but has been disconnected");
return 0;
}
if (connect_unlocked(xsink)) {
// if we have an info hash then write the request-uri key for reporting/logging purposes
if (info)
info->setKeyValue("request-uri", new QoreStringNodeMaker("%s %s HTTP/%s", meth, msgpath && msgpath[0] ? msgpath : "/", http11 ? "1.1" : "1.0"), 0);
return 0;
}
}
// send the message
int rc = msock->socket->priv->sendHttpMessage(xsink, info, meth, msgpath, http11 ? "1.1" : "1.0", &nh, data, size, send_callback, QORE_SOURCE_HTTPCLIENT, timeout_ms, &msock->m, &aborted);
//sendHTTPMessage(xsink, info, meth, msgpath, http11 ? "1.1" : "1.0", &nh, data, size, QORE_SOURCE_HTTPCLIENT, timeout_ms);
if (rc) {
assert(*xsink);
if (rc == QSE_NOT_OPEN)
disconnect_unlocked();
return 0;
}
QoreHashNode* ah = 0;
while (true) {
ReferenceHolder<QoreHashNode> ans(msock->socket->readHTTPHeader(xsink, info, timeout, QORE_SOURCE_HTTPCLIENT), xsink);
if (!(*ans)) {
disconnect_unlocked();
assert(*xsink);
return 0;
}
// check HTTP status code
AbstractQoreNode* v = ans->getKeyValue("status_code");
if (!v) {
xsink->raiseException("HTTP-CLIENT-RECEIVE-ERROR", "no HTTP status code received in response");
return 0;
}
code = v->getAsInt();
// continue processing if "100 Continue" response received (ignore this response)
if (code == 100)
continue;
ah = ans.release();
break;
}
return ah;
}
示例3: TEST
TEST()
{
printf("testing OP_LOG_LE 6\n");
AbstractQoreNode* n = new QoreBigIntNode(1);
CaseNodeWithOperator cmp(n, 0, OP_LOG_LE);
AbstractQoreNode* lhs = new AbstractQoreNode(2.1);
ExceptionSink xsink;
bool b = cmp.matches(lhs, &xsink);
assert(!b);
lhs->deref(&xsink);
assert(!xsink);
}
示例4: getXmlData
QoreHashNode* QoreXmlReader::parseXmlData(const QoreEncoding* data_ccsid, int pflags, ExceptionSink* xsink) {
if (read(xsink) != 1)
return 0;
AbstractQoreNode* rv = getXmlData(xsink, data_ccsid, pflags, depth());
if (!rv) {
if (!*xsink)
xsink->raiseExceptionArg("PARSE-XML-EXCEPTION", xml ? new QoreStringNode(*xml) : 0, "parse error parsing XML string");
return 0;
}
assert(rv->getType() == NT_HASH);
return reinterpret_cast<QoreHashNode*>(rv);
}
示例5: hi
int command::append_buffers_to_list(row_result_t &column_info, row_output_buffers& all_buffers, QoreHashNode *h, ExceptionSink *xsink) {
HashIterator hi(h);
for (unsigned i = 0, n = column_info.size(); i != n; ++i) {
hi.next();
const output_value_buffer& buff = *all_buffers[i];
AbstractQoreNode* value = get_node(column_info[i], buff, xsink);
if (xsink->isException()) {
if (value) value->deref(xsink);
return -1;
}
QoreListNode *l = reinterpret_cast<QoreListNode *>(hi.getValue());
l->push(value);
} // for
return 0;
}
示例6: printd
QoreValue VarRefNode::evalValueImpl(bool& needs_deref, ExceptionSink* xsink) const {
QoreValue v;
if (type == VT_LOCAL) {
printd(5, "VarRefNode::evalImpl() this: %p lvar %p (%s)\n", this, ref.id, ref.id->getName());
v = ref.id->evalValue(needs_deref, xsink);
}
else if (type == VT_CLOSURE) {
printd(5, "VarRefNode::evalImpl() this: %p closure var %p (%s)\n", this, ref.id, ref.id->getName());
ClosureVarValue *val = thread_get_runtime_closure_var(ref.id);
v = val->evalValue(needs_deref, xsink);
}
else if (type == VT_LOCAL_TS) {
printd(5, "VarRefNode::evalImpl() this: %p local thread-safe var %p (%s)\n", this, ref.id, ref.id->getName());
ClosureVarValue *val = thread_find_closure_var(ref.id->getName());
v = val->evalValue(needs_deref, xsink);
}
else if (type == VT_IMMEDIATE)
v = ref.cvv->evalValue(needs_deref, xsink);
else {
assert(needs_deref);
printd(5, "VarRefNode::evalImpl() this: %p global var: %p (%s)\n", this, ref.var, ref.var->getName());
v = ref.var->eval();
}
AbstractQoreNode* n = v.getInternalNode();
if (n && n->getType() == NT_REFERENCE) {
ReferenceNode* r = reinterpret_cast<ReferenceNode*>(n);
bool nd;
QoreValue nv = r->evalValue(nd, xsink);
if (needs_deref)
discard(v.getInternalNode(), xsink);
needs_deref = nd;
return v = nv;
}
return v;
}
示例7: QORE_TRACE
AbstractQoreNode* QoreXmlReader::getXmlData(ExceptionSink* xsink, const QoreEncoding* data_ccsid, int pflags, int min_depth) {
xml_stack xstack;
QORE_TRACE("getXMLData()");
int rc = 1;
while (rc == 1) {
int nt = nodeTypeSkipWhitespace();
// get node name
const char* name = constName();
if (!name)
name = "--";
if (nt == -1) // ERROR
break;
if (nt == XML_READER_TYPE_ELEMENT) {
int depth = QoreXmlReader::depth();
xstack.checkDepth(depth);
AbstractQoreNode* n = xstack.getNode();
// if there is no node pointer, then make a hash
if (!n) {
QoreHashNode* h = new QoreHashNode;
xstack.setNode(h);
xstack.push(h->getKeyValuePtr(name), depth);
}
else { // node ptr already exists
QoreHashNode* h = n->getType() == NT_HASH ? reinterpret_cast<QoreHashNode*>(n) : 0;
if (!h) {
h = new QoreHashNode;
xstack.setNode(h);
h->setKeyValue("^value^", n, 0);
xstack.incValueCount();
xstack.push(h->getKeyValuePtr(name), depth);
}
else {
// see if key already exists
AbstractQoreNode* v;
bool exists;
v = h->getKeyValueExistence(name, exists);
if (!exists)
xstack.push(h->getKeyValuePtr(name), depth);
else {
if (!(pflags & XPF_PRESERVE_ORDER)) {
QoreListNode* vl = get_node_type(v) == NT_LIST ? reinterpret_cast<QoreListNode*>(v) : 0;
// if it's not a list, then make into a list with current value as first entry
if (!vl) {
AbstractQoreNode** vp = h->getKeyValuePtr(name);
vl = new QoreListNode;
vl->push(v);
(*vp) = vl;
}
xstack.push(vl->get_entry_ptr(vl->size()), depth);
}
else {
// see if last key was the same, if so make a list if it's not
const char* lk = h->getLastKey();
bool get_value = false;
if (keys_are_equal(name, lk, get_value)) {
// get actual key value if there was a suffix
if (get_value)
v = h->getKeyValue(lk);
QoreListNode* vl = get_node_type(v) == NT_LIST ? reinterpret_cast<QoreListNode*>(v) : 0;
// if it's not a list, then make into a list with current value as first entry
if (!vl) {
AbstractQoreNode** vp = h->getKeyValuePtr(lk);
vl = new QoreListNode;
vl->push(v);
(*vp) = vl;
}
xstack.push(vl->get_entry_ptr(vl->size()), depth);
}
else {
QoreString ns;
int c = 1;
while (true) {
ns.sprintf("%s^%d", name, c);
if (!h->existsKey(ns.getBuffer()))
break;
c++;
ns.clear();
}
xstack.push(h->getKeyValuePtr(ns.getBuffer()), depth);
}
}
}
}
}
// add attributes to structure if possible
if (hasAttributes()) {
ReferenceHolder<QoreHashNode> h(new QoreHashNode, xsink);
while (moveToNextAttribute(xsink) == 1) {
const char* aname = constName();
QoreStringNode* value = getValue(data_ccsid, xsink);
if (!value)
return 0;
h->setKeyValue(aname, value, xsink);
//.........这里部分代码省略.........
示例8: assert
void qore_program_private_base::newProgram() {
base_object = true;
po_locked = false;
exec_class = false;
// init thread local storage key
thread_local_storage = new qpgm_thread_local_storage_t;
// save thread local storage hash
assert(!thread_local_storage->get());
thread_local_storage->set(new QoreHashNode);
//printd(5, "qore_program_private_base::newProgram() this: %p\n", this);
// copy global feature list to local list
for (FeatureList::iterator i = qoreFeatureList.begin(), e = qoreFeatureList.end(); i != e; ++i)
featureList.push_back((*i).c_str());
// setup namespaces
RootNS = qore_root_ns_private::copy(*staticSystemNamespace, pwo.parse_options);
QoreNS = RootNS->rootGetQoreNamespace();
assert(QoreNS);
// setup initial defines
// add platform defines
dmap["QoreVersionString"] = new QoreStringNode(qore_version_string);
dmap["QoreVersionMajor"] = new QoreBigIntNode(qore_version_major);
dmap["QoreVersionMinor"] = new QoreBigIntNode(qore_version_minor);
dmap["QoreVersionSub"] = new QoreBigIntNode(qore_version_sub);
dmap["QoreVersionBuild"] = new QoreBigIntNode(qore_build_number);
dmap["QoreVersionBits"] = new QoreBigIntNode(qore_target_bits);
dmap["QorePlatformCPU"] = new QoreStringNode(TARGET_ARCH);
dmap["QorePlatformOS"] = new QoreStringNode(TARGET_OS);
#ifdef _Q_WINDOWS
dmap["Windows"] = &True;
#else
dmap["Unix"] = &True;
#endif
if (pwo.parse_options & PO_IN_MODULE)
dmap["QoreHasUserModuleLicense"] = &True;
QoreNamespace* ns = QoreNS->findLocalNamespace("Option");
assert(ns);
ConstantListIterator cli(qore_ns_private::getConstantList(ns));
while (cli.next()) {
AbstractQoreNode* v = cli.getValue();
assert(v);
// skip boolean options defined as False
if (v->getType() == NT_BOOLEAN && !reinterpret_cast<QoreBoolNode*>(v)->getValue())
continue;
dmap[cli.getName()] = v->refSelf();
}
#ifdef DEBUG
// if Qore library debugging is enabled, then set an option
dmap["QoreDebug"] = &True;
#endif
}