1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: loc_dir.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #include <ary/loc/loc_dir.hxx>
35 // NOT FULLY DEFINED SERVICES
36 #include <ary/loc/loc_file.hxx>
37 #include <sortedids.hxx>
38 #include "locs_le.hxx"
46 struct Directory::Container
48 typedef SortedIds
<Le_Compare
> SortedChildList
;
50 SortedChildList aSubDirectories
;
51 SortedChildList aFiles
;
62 Directory::Directory(Le_id i_assignedRoot
)
65 nAssignedRoot(i_assignedRoot
),
67 pChildren(new Container
)
69 aAssignedNode
.Assign_Entity(*this);
72 Directory::Directory( const String
& i_localName
,
73 Le_id i_parentDirectory
)
74 : sLocalName(i_localName
),
75 nParentDirectory(i_parentDirectory
),
78 pChildren(new Container
)
80 aAssignedNode
.Assign_Entity(*this);
83 Directory::~Directory()
88 Directory::Add_Dir(const Directory
& i_dir
)
90 pChildren
->aSubDirectories
.Add(i_dir
.LeId());
94 Directory::Add_File(const File
& i_file
)
96 pChildren
->aFiles
.Add(i_file
.LeId());
100 Directory::Search_Dir(const String
& i_name
) const
102 return pChildren
->aSubDirectories
.Search(i_name
);
106 Directory::Search_File(const String
& i_name
) const
108 return pChildren
->aFiles
.Search(i_name
);
112 Directory::do_Accept(csv::ProcessorIfc
& io_processor
) const
114 csv::CheckedCall(io_processor
,*this);
118 Directory::get_AryClass() const
124 Directory::inq_LocalName() const
130 Directory::inq_ParentDirectory() const
132 return nParentDirectory
;