~ubuntu-branches/ubuntu/utopic/cccc/utopic

« back to all changes in this revision

Viewing changes to cccc/cccc_rec.cc

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2003-08-23 04:34:05 UTC
  • Revision ID: james.westby@ubuntu.com-20030823043405-xnzd3mn3hwtvi6dr
Tags: upstream-3.pre81
ImportĀ upstreamĀ versionĀ 3.pre81

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * cccc_rec.cc
 
3
 */
 
4
 
 
5
#include "cccc_itm.h"
 
6
#include "cccc_rec.h"
 
7
#include "cccc_db.h"
 
8
 
 
9
CCCC_Project* CCCC_Record::active_project=NULL;
 
10
CCCC_Project* CCCC_Record::get_active_project() { return active_project; }
 
11
void CCCC_Record::set_active_project(CCCC_Project* prj) { active_project=prj; }
 
12
 
 
13
void CCCC_Record::merge_flags(string& new_flags)
 
14
{
 
15
  const char *new_flag_array=new_flags.c_str();
 
16
  const char *flag_array=flags.c_str();
 
17
  unsigned int len=strlen(flag_array);
 
18
  if(strlen(new_flag_array)==len)
 
19
    {
 
20
      char buf[100];
 
21
      unsigned int i;
 
22
      for(i=0; i<len;i++)
 
23
        {
 
24
          if(flag_array[i]=='?')
 
25
            {
 
26
              buf[i]=new_flag_array[i];
 
27
            }
 
28
          else
 
29
            {
 
30
              buf[i]=flag_array[i];
 
31
            }
 
32
        }
 
33
      buf[len]='\0';
 
34
      flags=buf;
 
35
    } 
 
36
  else 
 
37
    {
 
38
      // if the parent record has just been created it may have
 
39
      // an empty flags member, so we use Resolve_Fields to copy
 
40
      // the flags from the first extent
 
41
      Resolve_Fields(flags,new_flags);
 
42
    }
 
43
}
 
44
 
 
45
void CCCC_Record::add_extent(CCCC_Item& is)
 
46
{
 
47
  CCCC_Extent *new_extent=new CCCC_Extent;
 
48
  new_extent->GetFromItem(is);
 
49
  CCCC_Extent *inserted_extent=extent_table.find_or_insert(new_extent);
 
50
  if(new_extent != inserted_extent)
 
51
    {
 
52
      delete new_extent;
 
53
    }
 
54
}
 
55
 
 
56
 
 
57
string CCCC_Record::name(int /* level */) const { return ""; }
 
58
string CCCC_Record::key() const { return name(nlRANK); }
 
59
 
 
60
 
 
61
 
 
62
 
 
63
 
 
64
 
 
65
 
 
66
 
 
67
 
 
68
 
 
69