2

I would really like to use the \snippet function in the manual of my code, since it would embody DRY. However, part of my manual shows a user how to build up an example use case piece by piece for which I would need to include a disjoint snippets with my own code inserted in between. Something like:

Original code:

#include <A.h>
#include <B.h>
#include <C.h>

MyClass:MyClass(const std::string& name)
     : BObj_(name)
{
   AObj_.setReadyForAction();

   AObj_.deactivateSwitching();
}

I would like to include it in my manual as

#include <A.h>
...

MyClass:MyClass(const std::string& name)
     : AObj_(name)
{
   AObj_.setReadyForAction();

   ...
}

This would be three snippets (or two if one discounts the closing brace) merged with ...'s inbetween.

I could live without the ...'s, and so could also just see this is a single disjoint snippet.

Is it possible to merge snippets? Is it possible to define a disjoint snippet? Alternatively, is there any way I could include pieces of code just by reference to a line number in the file rather than using defined snippet markers?

1
  • You mentioned already something about "include pieces of code just by reference to a line number in the file", did you have look at \dontinclude and the command mentioned there? Commented Aug 4, 2017 at 17:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.