- Remarks
- Control Statements
- Standard (and boost) Types
- Standard (and boost) Functions and Idioms
- Classes
- Doxygen
- Miscellaneous
- Internal templates
-
Styling options from lh-style are applied on the snippets. In other words, the code presented here may be formatted differently regarding spaces and newlines.
-
Placeholders are represented within «French quotation marks».
-
Default snippets from mu-template aren't documented yet.
-
About variation points ... TBD
-
About so called snippet parameter ... TBD
-
About surrounding numbers ... TBD
Produces:
catch(«...») {
«catch-code»
}
Surround:
- The selection can be surrounded to become the catch-code
Produces:
for («Enum»::type «exception_type»(«exception_args»)=«Enum»::type()
; «exception_type»(«exception_args»)!=«Enum»::MAX__
; ++«exception_type»(«exception_args»))
{
«code»
}
Surround:
- The selection can be surrounded to become the loop code
Note:
- This snippet is meant to be used with cpp/enum snippets
Produces:
for («clsname»::«const_»iterator «b»=«cont»begin(), «exception_type»(«exception_args»)=«cont».end()
; «b»!=«exception_type»(«exception_args»)
; ++«b»)
{
«code»
}
Surround:
- The selection can be surrounded to become the loop code
Notes:
- Container name («cont»), and iterators names («b» and «exception_type»(«exception_args»)) are asked to the end user
Produces:
for («type» «elem» : «range») {
«code»
}
Parameters:
- type, default:
auto&&
- elem, default:
e
- range, default:
«range»
Surround:
- The selection can be surrounded to become the loop code
Produces:
for («int» «i»=0;«i»!=«N»;++«i») {
«code»
}
Surround:
- The selection can be surrounded to become the loop code
Produces:
for («std::size_t» «i»=0, «N»=...;«i»!=«N»;++«i») {
«code»
}
Surround:
- The selection can be surrounded to become the loop code
Produces: namespace «ns» { ... } // «ns»
Parameters:
- ns, default:
(bpg):[{ft}_]project_namespace
Options:
(bpg):[{ft}_]project_namespace
, which defaults to«ns»
lh#cpp#use_cpp17()
(bpg):cpp_use_nested_namespaces
Surround:
- The selection can be surrounded to become the namespace code
Notes:
- If the namespace parameter is
foo::bar
, this snippet produces two nested namespace definitions. - If C++17 flavour is selected, and
(bpg):cpp_use_nested_namespaces
is true, then a C++17 nested namespace will be used.
Produces:
throw «exception_type»(«exception_args»);«»
(within code context)- or
@throw «exception_type»«»
(within Doxygen comments)
Parameters:
exception_text
, default: cpp/internals/formatted-comm
Options:
(bpg):({ft}_)exception_type
, default:std:runtime_error
(bpg):({ft}_)exception_args
, default:v:1_
, functor that getsexception_txt
injected as parameter. A typical value would be:
:let b:exception_args = 'v:1_.lh#marker#txt(", ".b:cpp_project_namespace."::ExitCode::")'
Note that this expression dynamically adapts to the current
b:cpp_project_namespace
, and to the current marker characters.
- Doxygen related options:
*
(bpg):({ft_}dox_TagLeadingChar)
*(bpg):({ft_}dox_throw)
Relies on:
Also includes:
<stdexcept>
ifexception_type
starts withstd::
Produces:
try {
«code»
} catch(«std::exception const& e») {
«catch-code»
}
Surround:
- The selection can be surrounded to become the try-code
- The selection can be surrounded to become the catch-code
Produces:
while(std::getline(«stream»,«line»)) {
«code»;
}
Surround:
- The selection can be surrounded to become the loop code
Also includes:
<string>
Produces: std::auto_ptr<«type»>
Surround:
- The selection can be surrounded to become the value type
Also includes:
<memory>
Produces: std::auto_ptr<«type»> ptr(new «type»(args));
Surround:
- The selection can be surrounded to become the value type
Also includes:
<memory>
Notes:
- I hesitate to call it
cpp/make_auto_ptr
Produces: «i»fstream f(«filename»);
Surround:
- The selection can be surrounded to become the filename
Also includes:
<fstream>
Produces: std::list<«type»> «»
Surround:
- The selection can be surrounded to become the value type
Also includes:
<list>
Produces: std::map<«key»,«value»> «»
Surround:
- The selection can be surrounded to become the value type
- The selection can be surrounded to become the key type
Also includes:
<map>
Produces: boost::noncopyable
Also includes:
<boost/noncopyable.hpp>
Produces: boost::filesystem::path
Also includes:
<boost/filesystem.hpp>
Produces: boost::ptr_vector<«type»> «»
Surround:
- The selection can be surrounded to become the value type
Also includes:
<boost/ptr_container/ptr_vector.hpp>
Produces: std::set<«type»> «»
Surround:
- The selection can be surrounded to become the value type
Also includes:
<set>
Produces:
std::shared_ptr<«type»> «»
, in C++11 or moreboost::shared_ptr<«type»> «»
, otherwise
Options:
Surround:
- The selection can be surrounded to become the value type
Also includes:
<memory>
in C++11<boost/shared_ptr.hpp>
otherwise
Produces: std::string «»
Also includes:
<string>
Produces: std::unique_ptr<«type»>
Surround:
- The selection can be surrounded to become the value type
Also includes:
<memory>
Produces: std::unordered_map<«key»,«value»> «»
Surround:
- The selection can be surrounded to become the value type
- The selection can be surrounded to become the key type
Also includes:
<unordered_map>
Produces: std::unordered_set<«key»,«value»> «»
Surround:
- The selection can be surrounded to become the value type
- The selection can be surrounded to become the key type
Also includes:
<unordered_set>
Produces: std::vector<«type»> «»
Surround:
- The selection can be surrounded to become the value type
Also includes:
<vector>
Produces:
std::weak_ptr<«type»> «»
, in C++11 or moreboost::weak_ptr<«type»> «»
, otherwise
Options:
Surround:
- The selection can be surrounded to become the value type
Also includes:
<memory>
in C++11<boost/shared_ptr.hpp>
otherwise
Produces: assert(«assertion»)
Surround:
- The selection can be surrounded to become the «assertion»
Also includes:
<assert.h>
in C,<cassert>
in C++
Produces: srand(time(NULL));
Also includes:
<time.h>
in C,<ctime>
in C++<stdlib.h>
in C,<cstdlib>
in C++
TODO:
- Adapt the snippet to C++11 new random functions
Produces:
type lhs = (type) realloc(ptr, size); macro
if (! lhs) { macro
free(ptr); macro
ptr = NULL; macro
count = 0; macro
«error_message»; macro
return false macro
} macro
ptr = lhs;
Parameters:
- A dictionary that contains:
"ptr"
, default«p»
"lhs"
, defaultnew
+ ptr"type"
, default«clsname»
"count"
, default«count»
"size"
, default count* sizeof(
type)
"realloc"
, defaultrealloc
"free"
, defaultfree
"false"
, defaultfalse
"macro"
, default: an empty string, expected value:\\
Produces:
// C++98/03
array_size(«array»)
// C++11
std::extent<decltype(«array»)>::value`
// C++17
std::size(«array»)
Or whatever is specified into
(bpg):({ft}_)array_size
. Up to C++14, it's
recommended to follow the instructions generated as comments, and to put an
equivalent of C++17 std::size()
in a header file and use it. Let's say the
function is named myarray_size()
and put into myrange.h
, then define into
your project configuration file (e.g. a
_vimrc_local.vim
):
let b:cpp_array_size = {'file': 'myrange.h', 'funcname': 'myarray_size(%1)'}
Parameters:
- array, default «array»
Options:
Surround:
- The selection can be surrounded to become the array name
Also includes:
<type_traits>
in C++11 and C++14<iterator>
from C++17 onward
Notes:
- In C++98/03, the definition of
array_size()
macro is provided along the way
TODO:
- Define the unsafe C equivalent
c/array_size
:sizeof «array»/sizeof «array»[0]
- In C++17, detect whether there is a
using std::size
in the context to rely on ADL and/or(bpg):cpp_begin_end_style
equals "adl ;"
Assign values to mu-template snippet variables:
s:begin
s:end
s:container
Their values will be:
- either
std::begin(«container»)
andstd::end(«container»)
if C++11 flavour is used, or if(bpg):cpp_begin_end_style
equals "std ;" - or
boost::begin(«container»)
andboost::end(«container»)
if(bpg):cpp_begin_end_style
equals "boost ;" - or
begin(«container»)
andend(«container»)
if(bpg):cpp_begin_end_style
equals "adl ;" - or
«container».begin()
and«container».end()
otherwise.
Also includes:
<iterator>
when(bpg):cpp_begin_end_style
is"std"
<boost/range/begin.hpp>
and<boost/range/end.hpp>
when(bpg):cpp_begin_end_style
is"boost"
- or whatever
(bpg):cpp_begin_end_includes
specifies
Parameters:
- container, default: «container»
Surround:
- The selection can be surrounded to become the container name
Options:
Produces:
- either
std::begin(«container»), std::end(«container»)
if C++11 flavour is used, or if(bpg):cpp_begin_end_style
equals "std" ; - or
boost::begin(«container»), boost::end(«container»)
if(bpg):cpp_begin_end_style
equals "boost" ; - or
«container».begin(), «container».end()
if(bpg):cpp_begin_end_style
equals "adl" ; - or
begin(«container»), end(«container»)
otherwise.
Also includes:
<iterator>
when(bpg):cpp_begin_end_style
is"std"
<boost/range/begin.hpp>
and<boost/range/end.hpp>
when(bpg):cpp_begin_end_style
is"boost"
- or whatever
(bpg):cpp_begin_end_includes
specifies
Parameters:
- container, default: «container»
Surround:
- The selection can be surrounded to become the container name
Options:
Variation Points:
cpp/internals/get-b-e
snippet
Produces: std::cerr <<
Also includes:
<iostream>
Produces: std::cin >>
Also includes:
<iostream>
Produces: std::copy(first, last, dest)
Parameters:
- container, default: «container»
Surround:
- The selection can be surrounded to become the container name
Also includes:
<algorithm>
TODO:
- Use
cpp/b-e
snippet
Produces: std::copy(«origin».begin(), «origin».end(), std::back_inserter(«dest»));
Parameters:
- origin, default: «origin»
- dest, default: «destination»
Surround:
- The selection can be surrounded to become the container name
- The selection can be surrounded to become the destination name
Also includes:
<algorithm>
<iterator>
TODO:
- Use
cpp/b-e
snippet
Produces: std::cout <<
Also includes:
<iostream>
Produces: boost::algorithm::ends_with(«input», «prefix_searched»)
Also includes:
<boost/algorithm/string/predicate.hpp>
Produces: erase-remove idiom
Parameters:
- container, default: «container»
Surround:
- The selection can be surrounded to become the container name
Also includes:
<algorithm>
TODO:
- Use
cpp/b-e
snippet
Produces: forward<«type»>(«var»)
Parameters:
- type, default: «type»
- var, default: «var»
Surround:
- The selection can be surrounded to become the variable
- The selection can be surrounded to become the type
Produces:
std::istringstream iss(str);
if (iss >> «»)
{ ... }
Also includes:
<sstream>
Produces:
std::ostringstream oss(str);
oss << «»;
Also includes:
<sstream>
Produces: std::sort(range.begin(), range.end());
Parameters:
- range, default: «range»
Surround:
- The selection can be surrounded to become the range name
Also includes:
<algorithm>
TODO:
- Use
cpp/b-e
snippet
Produces: boost::algorithm::starts_with(«input», «prefix_searched»)
Also includes:
<boost/algorithm/string/predicate.hpp>
Produces:
// C++11
static_assert(«cond», «msg»)
// C++98/03
BOOST_STATIC_ASSERT(«cond»)
Parameters:
- condition, default: «condition»
- message, default: «message»
Options:
Also includes:
<boost/static_assert.hpp>
, in C++98/03
Produces: typeid(«type»).name()
Parameters:
- type, default: «type»
Surround:
- The selection can be surrounded to become the type
Also includes:
<typeinfo>
Produces: «clsname»& operator=(«clsname» const&);
Parameters:
"clsname"
, the class name, default: automatically deduced bylh#cpp#AnalysisLib_Class#CurrentScope
, «clsname» otherwise"use_copy_and_swap"
: boolean, default: asked to the end-user
"copy-constructor"
: (dictionary)- "visibility": "public"/"protected"/"private"
- "how": ""/"deleted"/"defaulted"
Options:
Variation Points:
cpp/copy-and-swap
snippet, if the idiom is usedcpp/internals/function-comment
snippet
Relies on:
TODO:
- Detect C++11 to insert
noexcept
(through a variation point (snippet/option) as some frameworks have their own macro/keyword fornoexcept
)
Produces: A safe bool operator
compatible with C++98/03
Notes:
- The code produced follows the pattern presented by Matthew Wilson in Imperfect C++, Addisson-Welsey, §24.6
See:
- The snippet code
TODO:
- Detect C++11 to produce an
explicit bool operator()
instead.
Produces: assignment operator + swap
// + comments generated with cpp/function-comment
T& operator=(R rhs) {
this->swap(rhs);
return * this;
}
// + comments generated with cpp/function-comment
void swap(T & other);
Parameters:
"clsname"
, the class name, default: automatically deduced bylh#cpp#AnalysisLib_Class#CurrentScope
, «clsname» otherwise
Options:
Variation Points:
cpp/internals/function-comment
snippet
TODO:
- Detect C++11 to insert
noexcept
(through a variation point (snippet/option) as some frameworks have their own macro/keyword fornoexcept
)
Produces: T(T const&);
Parameters:
"clsname"
, the class name, default: automatically deduced bylh#cpp#AnalysisLib_Class#CurrentScope
, «clsname» otherwise
"copy-constructor"
: (dictionary)- "visibility": "public"/"protected"/"private"
- "how": ""/"deleted"/"defaulted"
Options:
Variation Points:
cpp/internals/function-comment
snippet
TODO:
- Add move copy-constructor, and move assignment-operator
- Detect C++11 to insert
noexcept
(through a variation point (snippet/option) as some frameworks have their own macro/keyword fornoexcept
)
Produces: T();
Parameters:
"clsname"
, the class name, default: automatically deduced bylh#cpp#AnalysisLib_Class#CurrentScope
, «clsname» otherwise
"default-constructor"
: (dictionary)- "visibility": "public"/"protected"/"private"
- "how": ""/"deleted"/"defaulted"
Options:
Variation Points:
cpp/internals/function-comment
snippet
TODO:
- Detect C++11 to insert
noexcept
(through a variation point (snippet/option) as some frameworks have their own macro/keyword fornoexcept
)
Produces: «virtual »~T();
Parameters:
"clsname"
, the class name, default: automatically deduced bylh#cpp#AnalysisLib_Class#CurrentScope
, «clsname» otherwise"is_virtual"
: boolean, default: «virtual »
"copy-constructor"
: (dictionary)- "visibility": "public"/"protected"/"private"
- "how": ""/"deleted"/"defaulted"/"pure"
Variation Points:
cpp/internals/function-comment
snippet
Options:
Produces:
«clsname» operator«X»(«clsname» lhs, «clsname» const& rhs)
{ return lhs «X»= rhs; }
Parameters:
"operator"
: binary operation name, default: «X»"clsname"
, the class name, default: automatically deduced bylh#cpp#AnalysisLib_Class#search_closest_class
Options:
Note:
- The code generated may change to encompass C++11 best practices and performances. See some experimentations I've done.
TODO:
cpp/internals/function-comment
snippet
Produces: istream& operator>>(istream &, class-type)
Relies on:
Produces: ostream& operator<<(ostream &, class-type)
Relies on:
The following snippets will generate new classes that follow the chosen semantics as closely as possible.
The currently supported semantics and idioms are:
- class, the simpliest snippet, unaware of anything
- value class, copyable, comparable
- entity class, non-copyable
- base class non virtual, NOT deletable through a pointer to the parent
- base class, deletable through a pointer to the parent
- abstract class
- interface (synonym to abstract class, for the moment)
- clonable class, bastard class, neither a real entity nor a value class.
- singleton
- exception
- empty exception
- traits
Surrounding: When used to surround a list of attributes (type + name), these will produce classes with:
- all these attributes,
- plus an initializing constructor that'll forward parameters to construct the attributes,
- plus all the related copy operations when the class has value semantics, and when there are non trivially-correctly copiable attributes (like a non view-pointer).
If you don't want to see an attribute used when generating these operations, add the attribute later, manually. Currently, neither getters no setters are generated automatically. As a few others I consider them to be bad practice . For now, use vim-refactor to generate const correct getters and setters that follow the naming policy configured for my plugins.
API: All these snippets can be used programmatically to generate even more
complex classes. See the related *-class_spec.rb
tests.
Licencing: Unlike other snippets, a few class patterns are under a BSL license.
TBD
Licence: BSL
Produces: A base class to inherit from with:
- A virtual pure public destructor
- A protected default constructor (unless specified otherwise)
- Non-copy-ability enforced
Parameters:
- Any parameter passed to
cpp/internals/class-skeleton
Options:
- Any options used by
cpp/internals/class-skeleton
. In particular:
Relies on:
Produces: A base class to inherit from with:
- A virtual public destructor, not necessarily pure (see
cpp/abstract-class
) - A protected default constructor (unless specified otherwise)
- Non-copy-ability enforced
Parameters:
- Any parameter passed to
cpp/internals/class-skeleton
Options:
- Any options used by
cpp/internals/class-skeleton
. In particular:
Relies on:
Produces: A base class to inherit from with:
- A protected non-virtual destructor
- A protected default constructor (unless specified otherwise)
- Non-copy-ability enforced
Parameters:
- Any parameter passed to
cpp/internals/class-skeleton
Options:
- Any options used by
cpp/internals/class-skeleton
. In particular:
Relies on:
Produces: a simplistic class definition, unaware of semantics.
Parameters:
- Any parameter passed to
cpp/internals/class-skeleton
Options:
(bpg):dox_group
, default: «Project»(bpg):({ft_}dox_TagLeadingChar)
- Any options used by
cpp/internals/class-skeleton
.
Relies on:
Todo:
- Have all class variations in their own template-file, and have the wizard glob compatible files to ask the use which one he prefers
- Enhance the semantics (see Big Rule of Two in C++98/03, Rule of All or
Nothing is C++11). We should have:
- value-semantics, no resources
- value-semantics, responsible for one resource
- value-semantics, with RAII encapsulated resource(s)
TBD:
Produces: A non-copiable class.
Parameters:
- Any parameter passed to
cpp/internals/class-skeleton
Options:
- Any options used by
cpp/internals/class-skeleton
. In particular:
Relies on:
TBD:
TBD
Meant to be used through :InsertEnum
command.
Options:
(bpg):({ft}_)dox_group
(bpg):cpp_begin_end_style
lh#cpp#use_cpp11()
andlh#cpp#use_cpp17()
(bpg):({ft}_)array_size
(bpg):({ft}_)exception_type
, default:std:runtime_error
(bpg):({ft}_)exception_args
, default:v:1_
, functor that getsexception_txt
injected as parameter
Variation Points/Relies on:
cpp/array_size
snippetcpp/static_assert
snippetcpp/throw
snippetcpp/internals/formatted-comment
snippet
TBD:
Meant to be used through :InsertEnum
command.
Options:
(bpg):({ft}_)exception_type
, default:std:runtime_error
(bpg):({ft}_)exception_args
, default:v:1_
, functor that getsexception_txt
injected as parameter(bpg):cpp_begin_end_style
(bpg):cpp_begin_end_includes
Variation Points/Relies on:
cpp/throw
snippetcpp/internals/get-b-e
snippetcpp/internals/formatted-comment
snippet
TBD:
Produces: An interface class to inherit from with:
- A virtual pure public destructor
- A protected default constructor (unless specified otherwise)
- Non-copy-ability enforced
Parameters:
- Any parameter passed to
cpp/internals/class-skeleton
Options:
- Any options used by
cpp/internals/class-skeleton
. In particular:
Relies on:
Note:
- At this moment, there is no difference between the
cpp/interface
and thecpp/abstract-class
snippets. I may eventually add simplified support for NVI idiom incpp/interface
snippet.
Produces: Wizard that produces a singleton class definition
Parameters:
- singleton name, default: asked to the user
Options:
(bpg):dox_group
, default: «Project»(bpg):({ft_}dox_TagLeadingChar)
Notes:
- A Doxygen documentation skeleton is inserted
- The user is asked to choose the kind of singleton implementation he desires
- Scott Meyer's singleton (local-static, MT-safe (C++11), lazy-construction supported)
- My own appreciation of what a singleton shall look like (MT-safe, no lazy construction, but explicit initialisation)
Also includes:
<boost/noncopyable.hpp>
Variation Points:
- mu-template "c/section-sep" snippet
Relies on:
CppDox_SingletonWizard()
Todo:
- Have all singleton variations in their own template-file, and have the wizard glob compatible files to ask the use which one he prefers
- Use cpp/internals/function-comment
Produces: traits-class
/** «name» traits class.
*/
template <typename «T»> struct «name»_traits
{ <++> };
Produces: @author
Options:
Relies on:
Produces: <code>«code»</code>
Parameters:
- «code», default: empty placeholder «»
Options:
Surround:
- The selection can be surrounded by
<code>
tags.
Relies on:
Produces: <em>cpp/internals/formatted-comm</em>
Parameters:
- cpp/internals/formatted-comm, default: empty placeholder «»
Options:
Surround:
- The selection can be surrounded by
<em>
tags.
Relies on:
Produces: /** @file ... */
Options:
(bpg):dox_group
, default: «Project»(bpg):ProjectVersion
, default: «1.0»(bpg):({ft_}dox_TagLeadingChar)
Notes:
- The filename written with the
@file
tag is deduced fromexpand(%:t)
Relies on:
TODO:
- Recognize SVN/CVS context to not always include RCS tags like
$Id$
Produces: /** @ingroup, @params, @exceptions, @pre, ... */
Note:
- This snippet is used to organize the various elements computed by
:DOX
- Its internal are likely to change in the future to factorize the code with
autoload/lh/dox.vim
and other snippets like cpp/internals/function-comment
Produces: Doxygen local group
//@{
«»
//@}
Surround:
- The selection can be surrounded by the group tags
Produces: <html-tag>cpp/internals/formatted-comm</html-tag>
Parameters:
- cpp/internals/formatted-comm, default: empty placeholder «»
Options:
Surround:
- The selection can be surrounded by the html-tags
- The selection can become the HTML tags
Relies on:
Produces: /**@ingroup ... */
Options:
(bpg):dox_group
, default: «Project»(bpg):({ft_}dox_TagLeadingChar)
Relies on:
Produces: @since Version
Options:
(bpg):ProjectVersion
, default: «1.0»(bpg):({ft_}dox_TagLeadingChar)
Relies on:
Produces: <tt>cpp/internals/formatted-comm</tt>
Parameters:
- cpp/internals/formatted-comm, default: empty placeholder «»
Options:
Surround:
- The selection can be surrounded by
<tt>
tags.
Relies on:
Produces:
- in insert-mode, or with no count when surrounding:
#if 0
«code;»
#endif
- with a count when surrounding:
#if 1
v:count first lines
#else
remaining lines
#endif
Options:
v:count
, when surrounding
Surround:
- The selection can be surrounded by this snippet.
This template file can be assimilated to the core routine used to generate all C++ classes (values, entities, base classes, interfaces, exceptions, etc).
Parameters
comments
: List of Doxygen entries for the class that are passed to cpp/internals/formatted-comment.clsname
: The name of the class to generate.final
: Boolean that tells whether the class isfinal
(C++11)noncopyable
/copyable
: Tells whether the copyability of the class is known (0 or 1), or unknown (-1)functions
: List of functions to declare in the class -- object built throughlh#cpp#snippets#new_function_list()
public|protected|private
:signature
implementation
visibility
:'public'
,'protected'
,'private'
,'none'
how
:'deleted'
,'defaulted'
,'pure'
,''
virtual
comments
attributes
: List of attributes to declare in the class -- elements are tag entries, or built withlh#cpp#snippets#_decode_selected_attributes()
. Typical keys are:name
type
functions
parents
: List that describes the parent classes- Special functions: Parameters that tune the various special functions:
init-constructor
default-constructor
copy-constructor
destructor
assignment-operator
Typical keys are:visibility
:'public'
,'protected'
,'private'
,'none'
how
:'deleted'
,'defaulted'
,'pure'
,''
virtual
comments
TODO:
- find a way to order members
- find a way to group members
- option to disable comments in defaulted functions
- C++11 move copy & move assign
- Enforce rule of "all or nothing"
- Find a way to specify attributes to use in init-ctr and w/ getters/setters when surrounding.
- Add option to force copiable classes to always be
final
- Add option to force the generation of getters and setters when surrounding attributes.
Produces: The empty definition for a stream operation.
Parameters
s:direction
:i
oro
Notes:
s:clsname
: The name of the current class/type is searched withCpp_SearchClassDefinition()
, it will be asked to the user if none is founds:friend
is assigned tofriend
if a class was founds:const
is assigned toconst
if a class was founds:op
,s:type
ands:stream_param
are deduced froms:direction
Relies on:
Produces:
{
return «s:stream_param» «s:op» «fields»;
}
Parameters
s:stream_param
:is
oros
s:op
:>>
or<<
s:direction
:i
oro
Options:
Also includes:
<istream>
ifs:direction == "i"
- or
<ostream>
ifs:direction == "o"
Produces:
«s:friend»«s:type»& operator«s:op»(«s:type» & «s:stream_param», «s:clsname» «s:const»& v)
Parameters
s:clsname
: The name of the class/type the operator applies to.s:stream_param
:is
oros
s:type
:std::istream
orstd::ostream
s:op
:>>
or<<
s:friend
:friend
or empty strings:const
:const
or empty string
Options: