////////////////////////////////////////////////////////////////////////// OpenImpl //////////////////////////////////////////////////////////////////////////
| 148 | // OpenImpl |
| 149 | /////////////////////////////////////////////////////////////////////////////// |
| 150 | void cHierDatabase::OpenImpl(bool bTruncate) //throw (eArchive, eHierDatabase) |
| 151 | { |
| 152 | // now, we should write the root node at (0,0) if we are creating, and assert that the root node |
| 153 | // is there if we are opening an existing one... |
| 154 | // |
| 155 | if (bTruncate) |
| 156 | { |
| 157 | // |
| 158 | // make the root node that we are creating... |
| 159 | // |
| 160 | cHierRoot rootNode; |
| 161 | rootNode.mChild = cHierAddr(0, 1); // the first array will be placed at (0,1) |
| 162 | rootNode.mbCaseSensitive = mbCaseSensitive; |
| 163 | rootNode.mDelimitingChar = mDelimitingChar; |
| 164 | cHierAddr addr = util_WriteObject(this, &rootNode); |
| 165 | // |
| 166 | // assert that it was written to (0, 0) |
| 167 | // |
| 168 | ASSERT((addr.mBlockNum == 0) && (addr.mIndex == 0)); |
| 169 | // |
| 170 | // make an empty array to serve as the root array. |
| 171 | // |
| 172 | cHierArrayInfo arrayInfo; |
| 173 | arrayInfo.mParent = cHierAddr(); |
| 174 | arrayInfo.mArray = cHierAddr(); |
| 175 | // |
| 176 | // actually write the objects and assert that they were written to the right places. |
| 177 | // |
| 178 | addr = util_WriteObject(this, &arrayInfo); |
| 179 | ASSERT((addr.mBlockNum == 0) && (addr.mIndex == 1)); |
| 180 | |
| 181 | mRootArrayAddr = cHierAddr(0, 1); |
| 182 | } |
| 183 | else |
| 184 | { |
| 185 | cHierRoot rootNode; |
| 186 | util_ReadObject(this, &rootNode, cHierAddr(0, 0)); |
| 187 | // |
| 188 | // set the location of the top-level array and the other root parameters... |
| 189 | // |
| 190 | mRootArrayAddr = rootNode.mChild; |
| 191 | mbCaseSensitive = rootNode.mbCaseSensitive; |
| 192 | mDelimitingChar = rootNode.mDelimitingChar; |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | //----------------------------------------------------------------------------- |
| 197 | // cHierDatabaseIter |
nothing calls this directly
no test coverage detected