File: cccc_itm.h

package info (click to toggle)
cccc 3.pre81-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,820 kB
  • ctags: 4,972
  • sloc: ansic: 33,244; cpp: 10,691; java: 618; makefile: 165; sh: 11
file content (42 lines) | stat: -rw-r--r-- 981 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// cccc_itm.h
#ifndef __CCCC_ITM_H
#define __CCCC_ITM_H

#include "cccc.h"

// Class CCCC_Item is a wrapper for a C++ standard string which allows
// insertion and extraction of fields using a standard delimiter.
// It is intended for use in the following contexts:
// 1. for transmission of extent information from the parser to the database
// 2. for transmission of option information from the main line to the database
// 3. for storage from the database to a flat file
// 4. for reloading from a flat file to the database.

class CCCC_Item
{
private:
  char delimiter;
  string buffer;
  bool good;

public:
  CCCC_Item(const string& s="", char c='@');

  bool Insert(const string& s); 
  bool Insert(const char* cptr); 
  bool Extract(string& s);
  bool Insert(int n); 
  bool Extract(int& n);
  bool Insert(char c);
  bool Extract(char& c);
  bool Insert(float f);
  bool Extract(float& f);

  bool ToFile(ofstream& ofstr);
  bool FromFile(ifstream& ifstr);
};
  
#endif