Page MenuHomePhorge

kolabformatchecker.cpp
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

kolabformatchecker.cpp

/*
* Copyright (C) 2012 Sofia Balicka <balicka@kolabsys.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <boost/program_options.hpp>
#include <iostream>
#include <string>
#include <vector>
#include <kolabformat.h>
#include "kolabformat/errorhandler.h"
#include "tests/testutils.h"
#include "kolabformat/kolabobject.h"
#include "qstring.h"
namespace po = boost::program_options;
using namespace std;
int main(int argc, char *argv[])
{
// Declare the supported options.
po::options_description desc("Allowed options");
desc.add_options()
("help", "produce help message")
("input-file", po::value<std::vector<std::string> >(), "input files")
;
po::positional_options_description p;
p.add("input-file", -1);
po::variables_map vm;
po::store(po::command_line_parser(argc, argv).
options(desc).positional(p).run(), vm);
po::notify(vm);
if (vm.count("help")) {
cout << desc << "\n";
return 1;
}
vector<string> inputFiles;
if (vm.count("input-file")) {
inputFiles = vm["input-file"].as< vector<string> >();
} else {
cout << "Specify input-file\n";
return -1;
}
int returnValue = 0;
cout << endl;
for(vector<string>::const_iterator it = inputFiles.begin();
it != inputFiles.end(); it++){
cout << "File: " << *it << endl;
bool ok;
KMime::Message::Ptr message = readMimeFile( QString::fromStdString(*it), ok);
if(!ok){
returnValue = -1;
cout << endl;
continue;
}
Kolab::KolabObjectReader reader(message);
if (Kolab::ErrorHandler::errorOccured()){
cout << "Errors occured during parsing." << endl;
returnValue = -1;
} else {
cout << "Parsed message without error." << endl;
}
cout << endl;
}
return returnValue;
}

File Metadata

Mime Type
text/x-c++
Expires
Mon, Apr 6, 2:57 AM (2 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
8b/01/cd021cc45099a87b2e78a1cd9d06
Default Alt Text
kolabformatchecker.cpp (2 KB)

Event Timeline