debian: added giffgaff chatscripts
[barry.git] / src / dp_parser.cc
blob5dd91f3496324aafe3e7ee9ffc7198e3ec0d6a98
1 /**
2 * @file dp_parser.cc
3 * @author Nicolas VIVIEN
4 * @date 2009-08-01
6 * @note CopyRight Nicolas VIVIEN
8 * @brief COD debug file parser
9 * RIM's JDE generates several files when you build a COD application.
10 * Indeed, with the COD files for the device, we have a ".debug" file.
11 * This file is usefull to debug an application from JVM.
12 * This tool is a parser to understand these ".debug" files.
13 * Obviously, the file contents only some strings and 32 bits words.
15 * @par Modifications
16 * - 2009/08/01 : N. VIVIEN
17 * - First release
19 * @par Licences
20 * Copyright (C) 2009-2010, Nicolas VIVIEN
22 * This program is free software; you can redistribute it and/or modify
23 * it under the terms of the GNU General Public License as published by
24 * the Free Software Foundation; either version 2 of the License, or
25 * (at your option) any later version.
27 * This program is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
31 * See the GNU General Public License in the COPYING file at the
32 * root directory of this project for more details.
36 #include <iostream>
37 #include <stdlib.h>
38 #include "dp_parser.h"
39 #include "endian.h"
42 using namespace std;
45 namespace Barry {
47 namespace JDG {
50 string ParseString(istream &input, const int length)
52 int i;
53 string str;
55 for (i=0; i<length; i++) {
56 uint16_t value;
58 input.read((char *) &value, sizeof(uint16_t));
60 str += (char) be_btohs(value);
63 return str;
67 uint32_t ParseInteger(istream &input)
69 uint32_t value;
71 input.read((char *) &value, sizeof(uint32_t));
73 return be_btohl(value);
77 } // namespace JDG
79 } // namespace Barry