예제 #1
0
void HTMLForm::load(const HTTPRequest& request, std::istream& requestBody, PartHandler& handler)
{
	if (request.getMethod() == HTTPRequest::HTTP_POST)
	{
		std::string mediaType;
		NameValueCollection params;
		MessageHeader::splitParameters(request.getContentType(), mediaType, params); 
		_encoding = mediaType;
		if (_encoding == ENCODING_MULTIPART)
		{
			_boundary = params["boundary"];
			readMultipart(requestBody, handler);
		}
		else
		{
			readUrl(requestBody);
		}
	}
	else
	{
		URI uri(request.getURI());
		std::istringstream istr(uri.getRawQuery());
		readUrl(istr);
	}
}
예제 #2
0
void HTMLForm::read(std::istream& istr, PartHandler& handler)
{
	if (_encoding == ENCODING_URL)
		readUrl(istr);
	else
		readMultipart(istr, handler);
}
예제 #3
0
RssReader::RssReader(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::RssReader)
{
    ui->setupUi(this);
    QTreeWidgetItem *root1 = new QTreeWidgetItem(this->ui->treeWidget_Rsslist,QStringList(QString(QObject::tr("科技"))));
    QTreeWidgetItem *root2 = new QTreeWidgetItem(this->ui->treeWidget_Rsslist,QStringList(QString(QObject::tr("社会"))));
    QTreeWidgetItem *root3 = new QTreeWidgetItem(this->ui->treeWidget_Rsslist,QStringList(QString(QObject::tr("生活"))));
    QTreeWidgetItem *leaf1 = new QTreeWidgetItem(root1,QStringList(QString("cnBeta")));
    QTreeWidgetItem *leaf2 = new QTreeWidgetItem(root1,QStringList(QString("新浪焦点新闻")));
    QTreeWidgetItem *leaf3 = new QTreeWidgetItem(root3,QStringList(QString("糗事百科")));
    ui->webView_Rss->setHtml("<body style=\"background-color:rgb(222,222,222);font-family:微软雅黑\"></body>");
    //ui->webView_Passage->setHtml("<body style=\"background-color:rgb(222,222,222);font-family:微软雅黑\"></body>");
    pRssObject = new RssObject(this);
    pGetRss = new QNetworkAccessManager(this);
    pGetPassage = new QNetworkAccessManager(this);
    connect(pGetRss,SIGNAL(finished(QNetworkReply*)),this,SLOT(RssFinished(QNetworkReply*)));
    connect(pGetPassage,SIGNAL(finished(QNetworkReply*)),this,SLOT(PassageFinished(QNetworkReply*)));
    connect(ui->webView_Rss->page()->mainFrame(),SIGNAL(javaScriptWindowObjectCleared()),this,SLOT(addJavaScriptObject()));
    connect(pRssObject,SIGNAL(sendHTML(QString)),this,SLOT(readUrl(QString)));
    connect(ui->treeWidget_Rsslist,SIGNAL(itemClicked(QTreeWidgetItem*,int)),this,SLOT(ChoseRss(QTreeWidgetItem*)));
    ui->webView_Passage->hide();
}
예제 #4
0
파일: HTMLForm.cpp 프로젝트: Chingliu/poco
void HTMLForm::read(const std::string& queryString)
{
	std::istringstream istr(queryString);
	readUrl(istr);
}
예제 #5
0
파일: HTMLForm.cpp 프로젝트: Chingliu/poco
void HTMLForm::read(std::istream& istr)
{
	readUrl(istr);
}
예제 #6
0
Token::Type CssTokenizer::readNextToken(){
  if (in == NULL) {
    currentToken.type = Token::EOS;
    return Token::EOS;
  }

  currentToken.clear();
  switch (lastRead) {
  case '@':
    currentToken.type = Token::ATKEYWORD;
    currentToken.add(lastRead);
    readChar();
    if (!readIdent()) {
      currentToken.type = Token::OTHER;
    }
    break;
    
  case '#':
    currentToken.type = Token::HASH;
    currentToken.add(lastRead);
    readChar();
    if (!readName()) {
      throw new ParseException(&lastRead,
                               "name following '#'");
    }
    break;
    
  case '-':
    currentToken.add(lastRead);
    readChar();
    if (readNum(true)) {
      currentToken.type = Token::NUMBER;
      readNumSuffix();
    } else if (readIdent()) {
      currentToken.type = Token::IDENTIFIER;
    } else
      currentToken.type = Token::OTHER;
    break;
    
  case '~':
    currentToken.add(lastRead);
    readChar();
    if (lastRead == '=') {
      currentToken.add(lastRead);
      readChar();
      currentToken.type = Token::INCLUDES;
    } else
      currentToken.type = Token::OTHER;
    break;
    
  case '|':
    currentToken.add(lastRead);
    readChar();
    if (lastRead == '=') {
      currentToken.add(lastRead);
      readChar();
      currentToken.type = Token::DASHMATCH;
    } else
      currentToken.type = Token::OTHER;
    break;
    
  case '/':
    currentToken.add(lastRead);
    readChar();
    if (readComment()) 
      currentToken.type = Token::COMMENT;
    else
      currentToken.type = Token::OTHER;
    break;
    
  case ';':
    currentToken.type = Token::DELIMITER;
    currentToken.add(lastRead);
    readChar();
    break;
  case ':':
    currentToken.type = Token::COLON;
    currentToken.add(lastRead);
    readChar();
    break;
  case '{':
    currentToken.type = Token::BRACKET_OPEN;
    currentToken.add(lastRead);
    readChar();
    break;
  case '}':
    currentToken.type = Token::BRACKET_CLOSED;
    currentToken.add(lastRead);
    readChar();
    break;
  case '(':
    currentToken.type = Token::PAREN_OPEN;
    currentToken.add(lastRead);
    readChar();
    break;
  case ')':
    currentToken.type = Token::PAREN_CLOSED;
    currentToken.add(lastRead);
    readChar();
    break;
  case '[':
    currentToken.type = Token::BRACE_OPEN;
    currentToken.add(lastRead);
    readChar();
    break;
  case ']':
    currentToken.type = Token::BRACE_CLOSED;
    currentToken.add(lastRead);
    readChar();
    break;
    
  case '.':
    currentToken.add(lastRead);
    readChar();
    if (readNum(false)) {
      currentToken.type = Token::NUMBER;
      readNumSuffix();
    } 
    break;

  default:
    if (readString()) 
      currentToken.type = Token::STRING;
    else if (readNum(true)) {
      currentToken.type = Token::NUMBER;
      readNumSuffix();

    } else if (readIdent()) {
      currentToken.type = Token::IDENTIFIER;

      if (currentToken.str == "url" && readUrl())
        currentToken.type = Token::URL;
      else if (currentToken.str == "u" && lastReadEq('+')) {
        currentToken.add(lastRead);
        readChar();
        currentToken.type = Token::UNICODE_RANGE;
        readUnicodeRange();
      }
    } else if (readWhitespace()) {
      currentToken.type = Token::WHITESPACE;
      while (readWhitespace()) {};
    } else {
      currentToken.add(lastRead);
      readChar();
    }
    break;
  }

  return currentToken.type;
}