From a534f39187dcea0c719357593d84380b594eca76 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Thu, 27 May 2010 14:12:24 +0200 Subject: [PATCH] Fixed a bug in the C++ domain and documented more --- doc/domains.rst | 42 ++++++++++++++++++++++++++++++++++++++++-- sphinx/domains/cpp.py | 2 ++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/doc/domains.rst b/doc/domains.rst index bf335368a..8e35a96a5 100644 --- a/doc/domains.rst +++ b/doc/domains.rst @@ -453,12 +453,50 @@ The following directives are available: .. cpp:type:: signatures Describe a C++ object. Full signature specification is supported -- give the - signature as you would in the declaration. Example:: + signature as you would in the declaration. Here some examples:: - .. cpp:function:: const T &Array::operator[]() const + .. cpp:function:: bool namespaced::theclass::method(int arg1, std::string arg2) + + Describes a method with parameters and types. + + .. cpp:function:: bool namespaced::theclass::method(arg1, arg2) + + Describes a method without types. + + .. cpp:function:: const T &array::operator[]() const Describes the constant indexing operator of a templated array. + .. cpp:function:: operator bool() const + + Describe a casting operator here. + + .. cpp:member:: std::string theclass::name + + .. cpp:type:: theclass::const_iterator + + Will be rendered like this: + + .. cpp:function:: bool namespaced::theclass::method(int arg1, std::string arg2) + + Describes a method with parameters and types. + + .. cpp:function:: bool namespaced::theclass::method(arg1, arg2) + + Describes a method without types. + + .. cpp:function:: const T &array::operator[]() const + + Describes the constant indexing operator of a templated array. + + .. cpp:function:: operator bool() const + + Describe a casting operator here. + + .. cpp:member:: std::string theclass::name + + .. cpp:type:: theclass::const_iterator + .. rst:directive:: .. cpp:namespace:: namespace Select the current C++ namespace for the following objects. diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py index 62dec4ac8..9ec2ab4be 100644 --- a/sphinx/domains/cpp.py +++ b/sphinx/domains/cpp.py @@ -318,6 +318,8 @@ class ArgumentDefExpr(DefExpr): return self.name.get_name() def get_id(self): + if self.type is None: + return 'X' return self.type.get_id() def __unicode__(self):