~ubuntu-branches/ubuntu/saucy/kopete/saucy-proposed

« back to all changes in this revision

Viewing changes to plugins/pipes/tests/main.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-06-21 02:22:39 UTC
  • Revision ID: package-import@ubuntu.com-20130621022239-63l3zc8p0nf26pt6
Tags: upstream-4.10.80
ImportĀ upstreamĀ versionĀ 4.10.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    main.cpp
 
3
 
 
4
    Copyright (c) 2007      by Charles Connell        <charles@connells.org>
 
5
 
 
6
    Kopete    (c) 2007      by the Kopete developers  <kopete-devel@kde.org>
 
7
 
 
8
    *************************************************************************
 
9
    *                                                                       *
 
10
    * This program is free software; you can redistribute it and/or modify  *
 
11
    * it under the terms of the GNU General Public License as published by  *
 
12
    * the Free Software Foundation; either version 2 of the License, or     *
 
13
    * (at your option) any later version.                                   *
 
14
    *                                                                       *
 
15
    *************************************************************************
 
16
*/
 
17
#include "tests.h"
 
18
 
 
19
#include <QCoreApplication>
 
20
#include <QFile>
 
21
#include <stdio.h>
 
22
 
 
23
/*
 
24
* This is an example of a program/script that could be used with
 
25
* the pipes plugin. We read everything from stdin, then perform a
 
26
* series of transformations on it. The actual work is done in
 
27
* KopeteXmlParserTests::test*
 
28
* The final text is then printed to stdout, where it is picked up
 
29
* by the Pipes plugin.
 
30
* Please see the real documentation for details on how to write
 
31
* pipes for the Pipes plugin.
 
32
*/
 
33
 
 
34
int main (int argc, char ** argv)
 
35
{
 
36
        QCoreApplication app (argc, argv);
 
37
        
 
38
        // open standard input
 
39
        QFile input (&app);
 
40
        input.open (stdin, QIODevice::ReadOnly | QIODevice::Text);
 
41
        
 
42
        // do tests
 
43
        QString parsed = KopeteXmlParserTests::test1 ( input.readAll() );
 
44
        
 
45
        // write modified text to standard out
 
46
        QFile output (&app);
 
47
        output.open (stdout, QIODevice::WriteOnly | QIODevice::Text );
 
48
        output.write ( parsed.toLocal8Bit() );
 
49
}
 
50