Exemplo n.º 1
0
UnitsEditPage::UnitsEditPage( UnitsEditDialog *dialog, int rows,
        const QString &pictureFile, const QString &pictureName,
        const QString &htmlFile, const char *name ) :
    AppPage( dialog, pictureFile, pictureName, htmlFile, name ),
    m_dialog(dialog),
    m_frame(0),
    m_grid(0),
    m_editList(0)
{
    // Hidden frame to contain a grid layout.
    m_frame = new QFrame( m_contentFrame, QString( "%1:Frame" ).arg( name ) );
    Q_CHECK_PTR( m_frame );
    m_frame->setFrameStyle( QFrame::NoFrame );

    // Create grid layout with rows+1 rows, 3 columns, 0 border, and 2 spacing.
    //int rows = 20;
    m_grid = new QGridLayout( m_frame, rows, 3, 0, 2,
        QString( "%1:Grid" ).arg( name ) );
    Q_CHECK_PTR( m_grid );
    // Create the page's UnitsEdit list
    m_editList = new QPtrList<UnitsEdit>();
    Q_CHECK_PTR( m_editList );
    // We do want to delete the UnitsEdit's when this class is destroyed.
    m_editList->setAutoDelete( true );
    // Add captions
    addHeaders();
    return;
}
Exemplo n.º 2
0
void createOutputCode(char* filename){
    FILE *file = fopen(filename, "w");

    if(! file){
        printf("Fatal error while creating output C file.\n");
        exit(EXIT_FAILURE);
    }

    addHeaders(file);
    declareGlobalVariables(file);
    declareReadDFAsFunction(file);
    declareNoActionFunction(file);
    declareFillTokensFunction(file);
    declareFillActionsFunction(file);
    declareGetNextStateFunction(file);
    declareGetSizeOfAcceptedInputFunction(file);
    declareGetGreatestFunction(file);
    declareUpdateLexemeFunction(file);
    declareGetFirstNCharsFunction(file);
    declareGetNewInputFunction(file);
    declareLexerFunction(file);
    declareMain(file);

    fclose(file);
}
Exemplo n.º 3
0
static JSObjectRef scriptObjectForResponse(JSContextRef context, const InspectorResource* resource)
{
    ASSERT_ARG(context, context);

    JSObjectRef object = JSObjectMake(context, 0, 0);
    addHeaders(context, object, resource->responseHeaderFields);

    return object;
}
Exemplo n.º 4
0
void CurlDownload::init(CurlDownloadListener* listener, ResourceHandle*, const ResourceRequest& request, const ResourceResponse&)
{
    if (!listener)
        return;

    URL url(ParsedURLString, request.url());

    init(listener, url);

    addHeaders(request);
}
Exemplo n.º 5
0
int DataPreprocessor::addIndicators(string fileName)
{
	ifstream inputStream;
	inputStream.open(fileName);

	ofstream outputStream;
	outputStream.open(fileName + string("_preprocessed.csv"));

	if (inputStream.is_open() && outputStream.is_open())
	{
		int closePriceIndex = 4;
		int volumeIndex = 5;
		int storedPricesCount = 200;
		closePrices = list<double>();

		string token;
		string line;

		istringstream ss;

		int i;
		getline(inputStream, line);
		addHeaders(line, indicators, outputStream);

		while (getline(inputStream, line))
		{
			ss = istringstream(line);
			i = 0;
			outputStream << line;
			while (getline(ss, token, ','))
			{
				if (i == closePriceIndex)
				{
					if (closePrices.size() == storedPricesCount)
					{
						closePrices.pop_front();
					}
					closePrices.push_back(stod(token));
				}
				i++;
			}
			addIndicatorValues(outputStream);
		}
		return 0;
	}
	else
	{
		return -1;
	}
}
Exemplo n.º 6
0
 void HttpInterface::evSubscribe(HttpRequest* req, strings& args)
 {
     // eventSubscriptions[conn] is an unordered set of strings
     if (args.size() == 1)
         eventSubscriptions[req].insert("*");
     else
         for (strings::iterator i = args.begin()+1; i != args.end(); ++i)
             eventSubscriptions[req].insert(*i);
     
     strings headers;
     headers.push_back("Content-Type: text/event-stream");
     headers.push_back("Cache-Control: no-cache");
     headers.push_back("Connection: keep-alive");
     addHeaders(req, headers);
     appendResponse(req,200,true,"");
     // connection must stay open!
 }
Exemplo n.º 7
0
void
Server::sendHeaders(Context *ctx) {
    addHeaders(ctx);
    ctx->response()->sendHeaders();
}