Pointwise Plugin SDK
PwpCwd.cxx
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * class PwpCwd
4  *
5  * Proprietary software product of Pointwise, Inc.
6  * Copyright (c) 1995-2018 Pointwise, Inc.
7  * All rights reserved.
8  *
9  ***************************************************************************/
10 
11 #include "pwpPlatform.h"
12 
13 #include "PwpCwd.h"
14 
15 
16 PwpCwd::PwpCwd(const char *dir) :
17  depth_(0)
18 {
19  push(dir);
20 }
21 
23 {
24  // clear this objects stack
25  while (pop());
26 }
27 
28 bool
29 PwpCwd::push(const char *dir)
30 {
31  bool ret = pushDir(dir);
32  if (ret) {
33  ++depth_;
34  }
35  return ret;
36 }
37 
38 bool
40 {
41  bool ret = false;
42  if (0 < depth_) {
43  ret = popDir();
44  --depth_;
45  }
46  return ret;
47 }
48 
49 bool
50 PwpCwd::pushDir(const char *dir)
51 {
52  return 0 == pwpCwdPush(dir);
53 }
54 
55 bool
57 {
58  return 0 == pwpCwdPop();
59 }
int depth_
The stack depth.
Definition: PwpCwd.h:119
PwpCwd(const char *dir=0)
Constructor.
Definition: PwpCwd.cxx:16
bool push(const char *dir)
Sets the current working directory.
Definition: PwpCwd.cxx:29
Cross Platform Functions.
static bool pushDir(const char *dir)
Sets the current working directory.
Definition: PwpCwd.cxx:50
int pwpCwdPop(void)
Restore the current directory.
static bool popDir()
Restores the current working directory.
Definition: PwpCwd.cxx:56
~PwpCwd()
Destructor.
Definition: PwpCwd.cxx:22
bool pop()
Restores the current working directory.
Definition: PwpCwd.cxx:39
int pwpCwdPush(const char *dir)
Change the current directory.