Ref<Object> String::each (Frame * frame) { String * self; Object * function; frame->extract()(self)(function); StringT::iterator current = self->_value.begin(); StringT::iterator previous = current; Cell * last = NULL, * first = NULL; while (current != self->_value.end()) { /* Unicode::CodePointT value = */ Unicode::next(current, self->_value.end()); // Create a buffer to contain the single character: String * character = new(frame) String(StringT(previous, current)); Cell * message = Cell::create(frame)(function)(character); Ref<Object> result = frame->call(message); last = Cell::append(frame, last, result, first); previous = current; } return first; }
token_cache() : cache(T_LAST_TOKEN - T_FIRST_TOKEN) { typename std::vector<StringT>::iterator it = cache.begin(); for (unsigned int i = T_FIRST_TOKEN; i < T_LAST_TOKEN; ++i, ++it) { *it = StringT(boost::wave::get_token_value(token_id(i))); } }
// qid optional // rql optional UrlT boffinTagcloud(const StringT& cometSession, const StringT& qid = StringT(), const StringT& rql = StringT()) { ParamsT params; paramsAdd(params, "auth", m_token); paramsAdd(params, "comet", cometSession); if (qid != "") { paramsAdd(params, "qid", qid); } return makeUrl("/boffin/tagcloud/" + rql, params); }
void Token::print_tree(std::ostream& outp, unsigned indent) const { //if (_identity != 0) { //if (terminal()) { outp << StringT(indent, '\t') << name_for_identity(_identity) << " : '" << value() << "'" << std::endl; //} else { // outp << StringT(indent, '\t') << name_for_identity(_identity) << " : " << std::endl; //} //} for (ChildrenT::const_iterator i = _children.begin(); i != _children.end(); i += 1) { i->print_tree(outp, indent+1); } }
Ref<Object> Frame::apply() { #ifdef KAI_DEBUG std::cerr << "-- " << Object::to_string(this, _message) << " <= " << Object::to_string(this, _scope) << std::endl; std::cerr << StringT(_depth, '\t') << "Fetching Function " << Object::to_string(this, _message->head()) << std::endl; #endif _function = _message->head()->evaluate(this); #ifdef KAI_DEBUG std::cerr << StringT(_depth, '\t') << "Executing Function " << Object::to_string(this, _function) << std::endl; this->debug(true); #endif if (!_function) { throw Exception("Invalid Function", _message->head(), this); } #ifdef KAI_TRACE // trace will be deconstructed even in the event of an exception. Trace trace(this); #endif return _function->evaluate(this); }
URI::URI(const StringT & s) : _url(s), _port(0) { URIImpl::Components components; URIImpl::IteratorT end = URIImpl::Parser::parse(_url.data(), _url.data() + _url.size(), components); if (!components.complete) { throw InvalidFormatError(_url, end - _url.data()); } if (components.scheme_begin != NULL) { _scheme = StringT(components.scheme_begin, components.scheme_end); } if (components.hierarchy_begin != NULL) { if (components.hierarchy.authority_begin != NULL) { _authority = StringT(components.hierarchy.authority_begin, components.hierarchy.authority_end); if (components.hierarchy.authority.user_info_begin != NULL) { StringT user_info(components.hierarchy.authority.user_info_begin, components.hierarchy.authority.user_info_end); split(user_info, ':', std::back_inserter(_user_info)); } if (components.hierarchy.authority.host_begin != NULL) { _hostname = StringT(components.hierarchy.authority.host_begin, components.hierarchy.authority.host_end); } if (components.hierarchy.authority.port_begin != NULL) { _port = std::stoul(StringT(components.hierarchy.authority.port_begin, components.hierarchy.authority.port_end)); } } if (components.hierarchy.path_begin != NULL) { _path = StringT(components.hierarchy.path_begin, components.hierarchy.path_end); } } if (components.query_begin != NULL) { _query = StringT(components.query_begin, components.query_end); } if (components.fragment_begin != NULL) { _fragment = StringT(components.fragment_begin, components.fragment_end); } }
bool Program::link() { glLinkProgram(_handle); GLint status; property(GL_LINK_STATUS, &status); glGetProgramiv(_handle, GL_LINK_STATUS, &status); if (status == 0) { // Something went wrong... Shared<Buffer> log = info_log(); LogBuffer buffer; buffer << "Error linking program:" << std::endl; buffer << StringT(log->begin(), log->end()) << std::endl; logger()->log(LOG_ERROR, buffer); } return status != 0; }
static void ExtractStrings( StringT *oStrings, const CharT *iChars, size_t iNumChars, size_t iNumStringsExpected ) { // To read any string, // just imagine how we'd do it? // Start with two pointers, one for beginning and one for end. // move the end one forward until a zero is encountered. // then move it one more forward, and it is an end. // if end-beginning == 1, it is an empty string, which CAN // happen. Put that string into the current string, and move // to the next string. size_t nextStringBegin = 0; size_t nextStringEnd = 0; size_t strIdx; for ( strIdx = 0; strIdx < iNumStringsExpected && nextStringBegin < iNumChars; ++strIdx ) { // Move the end caliper to the terminating zero, which may be // the beginning character in the case of an empty string. while ( iChars[nextStringEnd] != ( CharT )0 && nextStringEnd < iNumChars ) { ++nextStringEnd; } // Make sure we didn't have a premature EOS. if ( iChars[nextStringEnd] != ( CharT )0 ) { assert( nextStringEnd == iNumChars ); ABCA_THROW( "Corrupt compacted string array, premature end" ); } // Set the string to either the empty string // or the appropriate 0-terminated char string. StringT &thisString = oStrings[strIdx]; if ( nextStringEnd - nextStringBegin < 2 ) { // Assuming this makes an empty string. thisString = StringT(); assert( thisString.length() == 0 ); } else { const CharT *thisStrC = iChars + nextStringBegin; thisString = thisStrC; } // Move the front and end caliper past the terminal zero // to the beginning of the next string. nextStringBegin = nextStringEnd + 1; nextStringEnd = nextStringBegin; } // Okay, make sure we read the appropriate number of strings. ABCA_ASSERT( strIdx == iNumStringsExpected, "Corrupt compacted string array, premature end, " << "too few strings. Expected: " << iNumStringsExpected << ", but got: " << strIdx ); // All done. }
StringT Token::value() const { if (is_valid()) return StringT(_begin, _end); else return ""; }
StringT operator()(WIN32_FIND_DATA const& data) const { return StringT(data.cFileName); }