xref: /aoo42x/main/autodoc/inc/cosv/persist.hxx (revision 8a106958)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef CSV_PERSIST_HXX
25 #define CSV_PERSIST_HXX
26 
27 
28 // USED SERVICES
29 	// BASE CLASSES
30 	// COMPONENTS
31 #include <cosv/string.hxx>
32 	// PARAMETERS
33 
34 
35 namespace csv
36 {
37 namespace ploc
38 {
39 
40 class Path;
41 
42 
43 inline const char *
Delimiter()44 Delimiter()
45 {
46 #ifdef WNT
47     return "\\";
48 #elif defined(UNX)
49     return "/";
50 #else
51 #error  For using csv::ploc there has to be defined: WNT or UNX.
52 #endif
53 }
54 
55 
56 
57 class Persistent
58 {
59   public:
~Persistent()60     virtual             ~Persistent() {}
61 
62 	const Path &        MyPath() const;
63     /// @return all paths without completing delimiter, even directories.
64     const char *        StrPath() const;
65     bool                Exists() const;
66 
67   protected:
68                         Persistent();
69     void                InvalidatePath();
70 
71   private:
72 	virtual const Path &
73                         inq_MyPath() const = 0;
74     // DATA
75     mutable StreamStr   sPath;
76 };
77 
78 
79 
80 // IMPLEMENTATION
81 
82 inline
Persistent()83 Persistent::Persistent()
84     :   sPath(30) { }
85 inline const Path &
MyPath() const86 Persistent::MyPath() const
87     { return inq_MyPath(); }
88 inline void
InvalidatePath()89 Persistent::InvalidatePath()
90     { sPath.clear(); }
91 
92 
93 
94 }   // namespace csv
95 }   // namespace ploc
96 
97 
98 #endif
99 
100 
101 
102