[Libreoffice-commits] .: autodoc/source
Joseph Powers
jpowers at kemper.freedesktop.org
Sun Aug 21 07:06:50 PDT 2011
autodoc/source/display/inc/toolkit/out_node.hxx | 122 +++++++++++-------------
autodoc/source/display/toolkit/out_node.cxx | 75 +++++++-------
2 files changed, 95 insertions(+), 102 deletions(-)
New commits:
commit 97ae05a43f2701f78ddccd41d6f72887d61845d6
Author: Joseph Powers <jpowers27 at cox.net>
Date: Sun Aug 21 07:06:34 2011 -0700
Rename List -> NodeList
List was defined as std::vector< Node* >; but calling it List is confusing
since you don't know what type of list it is. Also it's just asking for
compile issues since we also use std::List, a custom List<>, & a class List.
I also removed Node::Children() since it wasn't used.
diff --git a/autodoc/source/display/inc/toolkit/out_node.hxx b/autodoc/source/display/inc/toolkit/out_node.hxx
index 1c837ec..d870a4e 100644
--- a/autodoc/source/display/inc/toolkit/out_node.hxx
+++ b/autodoc/source/display/inc/toolkit/out_node.hxx
@@ -29,9 +29,6 @@
#ifndef ADC_DISPLAY_OUT_NODE_HXX
#define ADC_DISPLAY_OUT_NODE_HXX
-
-
-
namespace output
{
@@ -45,87 +42,84 @@ namespace output
*/
class Node
{
- public:
- typedef std::vector< Node* > List;
+public:
+ typedef std::vector< Node* > NodeList;
typedef UINT32 relative_id;
// LIFECYCLE
- enum E_NullObject { null_object };
-
- Node();
- explicit Node(
- E_NullObject );
- ~Node();
-
- // OPERATORS
- bool operator==(
- const Node & i_node ) const
- { return pParent == i_node.pParent AND sName == i_node.sName; }
- bool operator!=(
- const Node & i_node ) const
- { return NOT operator==(i_node); }
-
- // OPERATIONS
- /// Seek, and if not existent, create.
- Node & Provide_Child(
- const String & i_name );
- /// Seek, and if not existent, create.
- Node & Provide_Child(
- const StringVector &
- i_path )
- { return provide_Child(i_path.begin(), i_path.end()); }
+ enum E_NullObject { null_object };
+
+ Node();
+ explicit Node( E_NullObject );
+ ~Node();
+
+ // OPERATORS
+ bool operator==( const Node& i_node ) const
+ { return pParent == i_node.pParent AND sName == i_node.sName; }
+
+ bool operator!=( const Node& i_node ) const
+ { return NOT operator==(i_node); }
+
+ // OPERATIONS
+ /// Seek, and if not existent, create.
+ Node& Provide_Child( const String& i_name );
+
+ /// Seek, and if not existent, create.
+ Node& Provide_Child( const StringVector& i_path )
+ { return provide_Child(i_path.begin(), i_path.end()); }
// INQUIRY
- intt Depth() const { return nDepth; }
+ intt Depth() const { return nDepth; }
const String & Name() const { return sName; }
+
/// @return Id of a namespace or class etc. this directory represents.
relative_id RelatedNameRoom() const { return nNameRoomId; }
/// @return No delimiter at start, with delimiter at end.
void Get_Path(
StreamStr & o_result,
- intt i_maxDepth = -1 ) const;
+ intt i_maxDepth = -1
+ ) const;
+
void Get_Chain(
StringVector & o_result,
- intt i_maxDepth = -1 ) const;
+ intt i_maxDepth = -1
+ ) const;
+
// ACCESS
- void Set_RelatedNameRoom(
- relative_id i_nNameRoomId )
- { nNameRoomId = i_nNameRoomId; }
- Node * Parent() { return pParent; }
- Node * Child(
- const String & i_name )
- { return find_Child(i_name); }
- List & Children() { return aChildren; }
+ void Set_RelatedNameRoom( relative_id i_nNameRoomId )
+ { nNameRoomId = i_nNameRoomId; }
+
+ Node* Parent() { return pParent; }
+ Node* Child( const String& i_name )
+ { return find_Child(i_name); }
/// @return a reference to a Node with Depth() == -1.
- static Node & Null_();
-
- private:
- // Local
- Node(
- const String & i_name,
- Node & i_parent );
-
- Node * find_Child(
- const String & i_name );
- Node & add_Child(
- const String & i_name );
- Node & provide_Child(
- StringVector::const_iterator
- i_next,
- StringVector::const_iterator
- i_end );
- // Data
- String sName;
- Node * pParent;
- List aChildren;
- intt nDepth;
+ static Node& Null_();
+
+private:
+ // Local
+ Node(
+ const String& i_name,
+ Node& i_parent
+ );
+
+ Node* find_Child( const String& i_name );
+
+ Node& add_Child( const String& i_name );
+
+ Node& provide_Child(
+ StringVector::const_iterator i_next,
+ StringVector::const_iterator i_end
+ );
+ // Data
+ String sName;
+ Node* pParent;
+ NodeList aChildren;
+ intt nDepth;
relative_id nNameRoomId;
};
-
-
} // namespace output
#endif
diff --git a/autodoc/source/display/toolkit/out_node.cxx b/autodoc/source/display/toolkit/out_node.cxx
index fb6dc19..f66b7aa 100644
--- a/autodoc/source/display/toolkit/out_node.cxx
+++ b/autodoc/source/display/toolkit/out_node.cxx
@@ -63,35 +63,37 @@ Node C_aNullNode(Node::null_object);
Node::Node()
: sName(),
- pParent(0),
- aChildren(),
- nDepth(0),
- nNameRoomId(0)
+ pParent(0),
+ aChildren(),
+ nDepth(0),
+ nNameRoomId(0)
{
}
Node::Node( E_NullObject )
: sName(),
- pParent(0),
- aChildren(),
- nDepth(-1),
- nNameRoomId(0)
+ pParent(0),
+ aChildren(),
+ nDepth(-1),
+ nNameRoomId(0)
{
}
-Node::Node( const String & i_name,
- Node & i_parent )
- : sName(i_name),
- pParent(&i_parent),
- aChildren(),
- nDepth(i_parent.Depth()+1),
- nNameRoomId(0)
+Node::Node(
+ const String & i_name,
+ Node & i_parent
+) :
+ sName(i_name),
+ pParent(&i_parent),
+ aChildren(),
+ nDepth(i_parent.Depth()+1),
+ nNameRoomId(0)
{
}
Node::~Node()
{
- for ( List::iterator it = aChildren.begin();
+ for ( NodeList::iterator it = aChildren.begin();
it != aChildren.end();
++it )
{
@@ -99,19 +101,18 @@ Node::~Node()
}
}
-Node &
-Node::Provide_Child( const String & i_name )
+Node& Node::Provide_Child( const String & i_name )
{
- Node *
- ret = find_Child(i_name);
+ Node* ret = find_Child(i_name);
if (ret != 0)
return *ret;
return add_Child(i_name);
}
-void
-Node::Get_Path( StreamStr & o_result,
- intt i_maxDepth ) const
+void Node::Get_Path(
+ StreamStr& o_result,
+ intt i_maxDepth
+) const
{
// Intentionally 'i_maxDepth != 0', so max_Depth == -1 sets no limit:
if (i_maxDepth != 0)
@@ -122,9 +123,10 @@ Node::Get_Path( StreamStr & o_result,
}
}
-void
-Node::Get_Chain( StringVector & o_result,
- intt i_maxDepth ) const
+void Node::Get_Chain(
+ StringVector & o_result,
+ intt i_maxDepth
+) const
{
if (i_maxDepth != 0)
{
@@ -138,13 +140,12 @@ Node::Get_Chain( StringVector & o_result,
}
}
-Node *
-Node::find_Child( const String & i_name )
+Node* Node::find_Child( const String & i_name )
{
Node aSearch;
aSearch.sName = i_name;
- List::const_iterator
+ NodeList::const_iterator
ret = std::lower_bound( aChildren.begin(),
aChildren.end(),
&aSearch,
@@ -155,11 +156,9 @@ Node::find_Child( const String & i_name )
return 0;
}
-Node &
-Node::add_Child( const String & i_name )
+Node& Node::add_Child( const String & i_name )
{
- DYN Node *
- pNew = new Node(i_name,*this);
+ DYN Node* pNew = new Node(i_name,*this);
aChildren.insert( std::lower_bound( aChildren.begin(),
aChildren.end(),
pNew,
@@ -168,9 +167,10 @@ Node::add_Child( const String & i_name )
return *pNew;
}
-Node &
-Node::provide_Child( StringVector::const_iterator i_next,
- StringVector::const_iterator i_end )
+Node& Node::provide_Child(
+ StringVector::const_iterator i_next,
+ StringVector::const_iterator i_end
+)
{
if (i_next == i_end)
return *this;
@@ -180,8 +180,7 @@ Node::provide_Child( StringVector::const_iterator i_next,
-Node &
-Node::Null_()
+Node& Node::Null_()
{
return C_aNullNode;
}
More information about the Libreoffice-commits
mailing list