File: path.h

package info (click to toggle)
mothur 1.48.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,684 kB
  • sloc: cpp: 161,854; makefile: 122; sh: 31
file content (63 lines) | stat: -rwxr-xr-x 885 bytes parent folder | download | duplicates (9)
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
#ifndef path_h
#define path_h

struct PathData
	{
private:
	PathData(PathData &);
	PathData &operator=(PathData &);

public:
	char *Start;
	char *Front;
	char *Back;
	unsigned Bytes;

public:
	PathData()
		{
		Clear(true);
		}
	~PathData()
		{
		Free();
		}
	void Free();
	void Alloc(unsigned MaxLen);
	void Clear(bool ctor = false)
		{
		Start = 0;
		if (ctor)
			{
			Front = 0;
			Back = 0;
			Bytes = 0;
			}
		else
			Free();
		}
	void Copy(const PathData &rhs);
	void FromStr(const char *PathStr);
	void Reverse()
		{
		asserta(Start != 0);
		unsigned L = (unsigned) strlen(Start);
		for (unsigned k = 0; k < L/2; ++k)
			{
			char c = Start[k];
			Start[k] = Start[L-k-1];
			Start[L-k-1] = c;
			}
		}
	void SetEmpty()
		{
		Start = 0;
		}

	bool IsEmpty() const
		{
		return Start == 0;
		}
	};

#endif // path_h