File: Addressbook.h

package info (click to toggle)
postman 2.1-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 8,240 kB
  • ctags: 3,249
  • sloc: cpp: 33,376; ansic: 2,014; sh: 780; makefile: 300
file content (75 lines) | stat: -rwxr-xr-x 1,929 bytes parent folder | download | duplicates (3)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
Addressbook.h
*/

#ifndef __ADDRESSBOOK_H
#define __ADDRESSBOOK_H

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "Language.h"
#include "Utils.h"
#include "XString.h"
#include "XVector.h"
#include "UserOptions.h"

typedef struct
  {
  XString Nickname, Fullname, Addresses, Fcc, Comment;
  } TEntry, *PEntry;

typedef XVector<TEntry> TAgenda;

void FlipEntries (const void *e1, const void *e2);
int CompareEntriesByNickname  (const void *e1, const void *e2);
int CompareEntriesByFullname  (const void *e1, const void *e2);
int CompareEntriesByFcc (const void *e1, const void *e2);
int CompareEntriesByAddresses (const void *e1, const void *e2);
      
class Addressbook
  {
  private:
    LINEA fnaddressbook;
    TAgenda agenda;
    bool MODIFIED;
    UserOptions *uo;
    int sortby;
    char *getToken (const char *linea, int numtoken, TBuffer token);
    void initEntry (TEntry *aentry);
    void setNickname (int pos, char *value);
    void setFullname (int pos, char *value);
    void setAddresses (int pos, char *value);
    void setFcc (int pos, char *value);
    void setComment (int pos, char *value);
  public:
    Addressbook (const char *fn, UserOptions *auo);
    virtual ~Addressbook ();
    void setSortby (int asortby);
    bool SaveAddressbook (void);
    bool SaveAddressbookAs (const char *fn);    
    void Clear (void);
    void SORT (int asortby);
    void readAddressbook (void); 
    int Count (void);
    char *getFulllinea (int pos);
    const char *getNickname (int pos);
    const char *getFullname (int pos);
    const char *getAddresses (int pos);
    char *getMultiAddresses (const char *positions);
    const char *getFcc (int pos);
    const char *getComment (int pos);
    bool DeleteEntries (const char *positions);
    void UpdateEntryFromFile (int numentry, char *fn);
    int AddNewEntry (void);
    int AddNewEntry (const char *addresses);
  };
 
#endif