예제 #1
0
TypedValue HHVM_FUNCTION(preg_match,
                         StringArg pattern, StringArg subject,
                         OutputArg matches /* = null */,
                         int flags /* = 0 */, int offset /* = 0 */) {
  return tvReturn(preg_match(StrNR(pattern.get()), StrNR(subject.get()),
                             matches.get() ? matches->var() : nullptr,
                             flags, offset));
}
예제 #2
0
fileUntil::AppendFile::AppendFile(StringArg filename)
	: fp_(::fopen(filename.c_str(), "a+")),
	  writtenBytes_(0)
{
	assert(fp_);
	::setbuffer(fp_, buffer_, sizeof buffer_);
}
예제 #3
0
int main( int argc,
          char **argv )
{
  StringArg first { "first", "The first name", "John" };
  StringArg last { "last", "The last name", "Doe" };
  SizeArg age { "age", "The (true?) age", 33 };
  DoubleArg height { "height", "How tall?", 1.92 };
  BoolArg like { "like", "You like not-jokes?", true };

  ArgumentParser::parseCommandLine( argc, argv );

  std::cout << "Hello World!" << std::endl;
  std::cout << "My name is " << *first << " " << last.value( ) << "." << std::endl;
  std::cout << "I am " << age << " years old." << std::endl;
  std::cout << "I am " << height << " m tall." << std::endl;
  std::cout << "I like telenovelas." << ( like ? "" : "..not!" ) << std::endl;
}
예제 #4
0
fileUntil::ReadSmallFile::ReadSmallFile(StringArg filename)
	: fd_(::open(filename.c_str(), O_RDONLY | O_CLOEXEC)),
	  err_(0)
{
	buf_[0] = '\0';

	if (fd_ < 0)
		err_ = errno;
}
예제 #5
0
bool Resolver::resolve(StringArg hostname, const Callback& cb){
    loop_->assertInLoopThread();
    QueryData* queryData = new QueryData(this, cb);
    ares_gethostbyname(ctx_, hostname.c_str(), AF_INET,
            &Resolver::ares_host_callback, queryData);
    struct timeval tv;
    struct timeval* tvp = ares_timeout(ctx_, NULL, &tv);
    double timeout = getSeconds(tvp);
    LOG_DEBUG << "timeout " << timeout << " active" << timerActive_;
    if(!timerActive_){
        loop_->runAfter(timeout, boost::bind(&Resolver::onTimer, this));
        timerActive_ = true;
    }
    return queryData != NULL;
}
예제 #6
0
void Request::setRange(const StringArg range){
    setopt(CURLOPT_RANGE, range.c_str());
}
예제 #7
0
RequestPtr Curl::getUrl(StringArg url){
    RequestPtr req(new Request(this, url.c_str()));
    return req;
}