source: branches/stable/CONVERTALN/rdp_info.h

Last change on this file was 16766, checked in by westram, 6 years ago
File size: 2.8 KB
Line 
1#ifndef RDP_INFO_H
2#define RDP_INFO_H
3
4#ifndef GLOBAL_H
5#include "global.h"
6#endif
7#ifndef FUN_H
8#include "fun.h"
9#endif
10
11// -------------------------------
12//      RDP-defined comments (Embl+GenBank)
13
14struct OrgInfo : virtual Noncopyable {
15    char *source;
16    char *cultcoll;
17    char *formname;
18    char *nickname;
19    char *commname;
20    char *hostorg;
21
22    OrgInfo() {
23        source   = no_content();
24        cultcoll = no_content();
25        formname = no_content();
26        nickname = no_content();
27        commname = no_content();
28        hostorg  = no_content();
29    }
30    ~OrgInfo() {
31        freenull(source);
32        freenull(cultcoll);
33        freenull(formname);
34        freenull(nickname);
35        freenull(commname);
36        freenull(hostorg);
37    }
38
39    void set_content_from(const OrgInfo& other) {
40        copy_content(source, other.source);
41        copy_content(cultcoll, other.cultcoll);
42        copy_content(formname, other.formname);
43        copy_content(nickname, other.nickname);
44        copy_content(commname, other.commname);
45        copy_content(hostorg, other.hostorg);
46    }
47
48    bool exists() const {
49        return
50            has_content(source) ||
51            has_content(cultcoll) ||
52            has_content(formname) ||
53            has_content(nickname) ||
54            has_content(commname) ||
55            has_content(hostorg);
56    }
57};
58
59struct SeqInfo : virtual Noncopyable {
60    char comp3;  // yes or no, y/n
61    char comp5;  // yes or no, y/n
62
63    char *RDPid;
64    char *gbkentry;
65    char *methods;
66
67    SeqInfo() {
68        comp3    = ' ';
69        comp5    = ' ';
70        RDPid    = no_content();
71        gbkentry = no_content();
72        methods  = no_content();
73    }
74    ~SeqInfo() {
75        freenull(RDPid);
76        freenull(gbkentry);
77        freenull(methods);
78    }
79    void set_content_from(const SeqInfo& other) {
80        comp3 = other.comp3;
81        comp5 = other.comp5;
82        copy_content(RDPid, other.RDPid);
83        copy_content(gbkentry, other.gbkentry);
84        copy_content(methods, other.methods);
85    }
86    bool exists() const {
87        return
88            comp3 != ' ' ||
89            comp5 != ' ' ||
90            has_content(RDPid)    ||
91            has_content(gbkentry) ||
92            has_content(methods);
93    }
94};
95
96struct RDP_comments : virtual Noncopyable {
97    OrgInfo  orginf;
98    SeqInfo  seqinf;
99    char    *others;
100
101    RDP_comments() : others(NULp) {}
102    ~RDP_comments() { freenull(others); }
103
104    void set_content_from(const RDP_comments& other) {
105        orginf.set_content_from(other.orginf);
106        seqinf.set_content_from(other.seqinf);
107        copy_content(others, other.others);
108    }
109    bool exists() const { return orginf.exists() || seqinf.exists() || has_content(others); }
110};
111
112#else
113#error rdp_info.h included twice
114#endif // RDP_INFO_H
Note: See TracBrowser for help on using the repository browser.