File: TjObjPosTable.h

package info (click to toggle)
taskjuggler 2.3.0-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 8,764 kB
  • ctags: 3,700
  • sloc: cpp: 36,852; sh: 12,761; xml: 5,541; perl: 5,207; makefile: 269; python: 258; lisp: 67
file content (69 lines) | stat: -rw-r--r-- 1,610 bytes parent folder | download
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
/*
 * The TaskJuggler Project Management Software
 *
 * Copyright (c) 2001, 2002, 2003, 2004, 2005 by Chris Schlaeger <cs@kde.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * $Id: TjObjPosTable.h 1315 2006-08-11 21:05:41Z cs $
 */

#ifndef _TjObjPosTable_h_
#define _TjObjPosTable_h_

#include <map>

#include <ltQString.h>

#include "TjObjPosTableEntry.h"

class CoreAttributes;

class TjObjPosTable
{
    friend class TjObjPosTableConstIterator;

public:
    TjObjPosTable() { }
    ~TjObjPosTable();

    void addEntry(CoreAttributes* ca, CoreAttributes* subCa,
                  int pos, int height);

    int caToPos(const CoreAttributes* ca, const CoreAttributes* subCa = 0)
        const;

    int caToHeight(const CoreAttributes* ca, const CoreAttributes* subCa = 0)
        const;

private:
    QString generateKey(const CoreAttributes* ca,
                        const CoreAttributes* subCa) const;

    std::map<const QString, TjObjPosTableEntry*, ltQString> entries;
} ;

class TjObjPosTableConstIterator
{
public:
    TjObjPosTableConstIterator(const TjObjPosTable& o) : opt(o)
    {
        it = opt.entries.begin();
    }
    ~TjObjPosTableConstIterator() { }

    TjObjPosTableEntry* operator*() const
    {
        return it == opt.entries.end() ? 0 : (*it).second;
    }
    void operator++() { ++it; }

private:
    const TjObjPosTable& opt;
    std::map<const QString, TjObjPosTableEntry*, ltQString>::const_iterator it;
} ;

#endif