in some file there is a function
///some description of the function foo.
void foo();
in a page in the documentation
\ref foo()
I get a link to foo() but is there a way to include the description
"///some description of the function foo."
along with the link.
The \ref command has as second argument the possibility to show a text but this text has to be between quotes and will be shown as link text. This means though that you have to type the text again.
When we assume that the requested text us the brief description of the function we could do something like:
/// \ref foo() \copybrief foo()
A full example:
/// \file
///
/// \ref foo()
///
/// \ref foo() \copybrief foo()
///
/// \ref bar()
///
/// \ref bar() "some description of the function bar."
///
/// \ref bar() \copybrief bar()
/// some description of the function foo.
void foo();
/// \brief some description of the function bar.
void bar();
Resulting in:
When the requested text is not the brief description, the user probably accomplish something with the commands like \copydetails / \copydoc or \snippet{doc}.
Related
I was documenting my code and I wanted to link another method in the same file
I want to refer to that method in a comment so anyone reading my comment can directly jump to that method where my comment refers
Method where I am documenting and I want to link to a method named toggleFavorite in the same file
// To avoid code duplication in [toggleFavorite] method
void _toogleFav(newStatus) {
isFavorite = newStatus;
notifyListeners();
}
This is what my toggleFavorite returns in case you need it
Future<void> toggleFavorite() async {
What I want
Exactly I want this word in my comment [toggleFavorite] to work as a link when I press this I get redirected to this method wherever it is created or used
Use triple /// and [] around the method
/// To avoid code duplication in [toggleFavorite] method
void _toogleFav(newStatus) {
isFavorite = newStatus;
notifyListeners();
}
here is my code
function foo(){
}
after passing it through the default formatter(alt+shift+f) I get:
function foo() {
}
(note the added space in the first line)
My question is: how do I set up the formatter so it does not add the space?
Question:
What is the correct format to add documentation (using built in functionality not 3rd party) to a custom Swift closure in Xcode 8 ?
Could you provide the Apple documentation link to refer ?
How to specify the closure parameters ?
How to specify the closure return type ?
Example:
struct S1 {
/// This block is executed after completion
var completion : (String, Int) -> (Bool)
}
Note:
Xcode 8 has built in functionality to add documentation to custom code.
This can be done, by doing one of the following:
Command + Option + Click on code
Keep cursor on code and Editor > Structure > Add documentation
Reference:
For reference see Markup Formatting Reference namely the section "Formatting Quick Help"
Workaround:
If those tags are not supported for the given location the only possible workaround seems to be right now:
struct S1 {
/// description
///
/// __returns__
/// blah blah
///
/// __parameters__
/// blah blah
var completion : (String, Int) -> (Bool)
}
I'm developing a media player with Vala and I want to be able to open audio files with this application (once it is installed).
In .descktop files I added the following MIME types to indicate which files can open (they are the same MIME types than in banshee):
MimeType=application/musepack;application/ogg;application/rss+xml;application/vnd.emusic-emusic_list;application/x-ape;application/x-democracy;application/x-extension-m4a;application/x-extension-mp4;application/x-flac;application/x-flash-video;application/x-id3;application/x-linguist;application/x-matroska;application/x-miro;application/x-musepack;application/x-netshow-channel;application/x-ogg;application/x-quicktime-media-link;application/x-quicktimeplayer;application/x-shorten;application/x-troff-msvideo;application/xspf+xml;audio/3gpp;audio/AMR;audio/AMR-WB;audio/ac3;audio/ape;audio/avi;audio/basic;audio/flac;audio/midi;audio/mp;audio/mp2;audio/mp3;audio/mp4;audio/mp4a-latm;audio/mpc;audio/mpeg;audio/mpeg3;audio/mpegurl;audio/musepack;audio/ogg;audio/vorbis;audio/wav;audio/wave;audio/x-amzxml;audio/x-ape;audio/x-flac;audio/x-it;audio/x-m4a;audio/x-matroska;audio/x-mod;audio/x-mp;audio/x-mp3;audio/x-mpc;audio/x-mpeg;audio/x-mpeg-3;audio/x-mpegurl;audio/x-ms-asf;audio/x-ms-asx;audio/x-ms-wax;audio/x-ms-wma;audio/x-musepack;audio/x-ogg;audio/x-pn-aiff;audio/x-pn-au;audio/x-pn-wav;audio/x-pn-windows-acm;audio/x-s3m;audio/x-sbc;audio/x-scpls;audio/x-speex;audio/x-tta;audio/x-vorbis;audio/x-vorbis+ogg;audio/x-wav;audio/x-wavpack;audio/x-xm;image/avi;image/x-pict;misc/ultravox;text/google-video-pointer;text/x-google-video-pointer;text/x-opml+xml;video/3gpp;video/avi;video/dv;video/fli;video/flv;video/mp4;video/mp4v-es;video/mpeg;video/msvideo;video/ogg;video/quicktime;video/vivo;video/vnd.divx;video/vnd.vivo;video/x-anim;video/x-avi;video/x-flc;video/x-fli;video/x-flic;video/x-flv;video/x-m4v;video/x-matroska;video/x-mpeg;video/x-mpg;video/x-ms-asf;video/x-ms-wm;video/x-ms-wmv;video/x-ms-wmx;video/x-ms-wvx;video/x-msvideo;video/x-nsv;video/x-ogm+ogg;video/x-theora;video/x-theora+ogg;x-scheme-handler/lastfm;x-scheme-handler/u1ms;
By donig this the application is shown in the dialog "Open with" when I click on a file.
Then, in my Gtk.Application class I added in the constructor:
class SomeClass (string[] args) {
Object (application_id: "some.id", flags: ApplicationFlags.HANDLES_OPEN);
// do stuff...
}
And finally I added the "open" method which is suposed to be called when a file is open with the aplication:
public override void open (File[] files, string hint) {
// do stuff ...
}
However, when I try to open a .mp3 file with my application appears a dialog which says:
"No es poden obrir els fitxers o uris amb aquesta aplicació"
in english:
"The files or uris can not be opened with this application"
So my question is: Am I missing something?
I've added MIME types in descktop file, I've activated the flag "HANDLES_OPEN" and I've implemented the method "open".
PD: I'm working with elementaryOS and I install my app with CMake build system.
In GLib/C terminology: You need to connect your implementation of open to the GApplication's ::open signal.
In Vala terminology: See signals:
class Foo : Object {
public signal void some_event (); // definition of the signal
public void method () {
some_event (); // emitting the signal (callbacks get invoked)
}
}
void callback_a () {
stdout.printf ("Callback A\n");
}
void callback_b () {
stdout.printf ("Callback B\n");
}
void main () {
var foo = new Foo ();
foo.some_event.connect (callback_a); // connecting the callback functions
foo.some_event.connect (callback_b);
foo.method ();
}
...
So, in Vala terms:
You need a reference to a GLib.Application.
You need to call app.connect(open); somewhere before your mainloop starts running.
I am using intellisense successfully in my javascript code for functions, but I don't know how to get it to work for a var or if I should be designing this class differently so I can document it effectively.
(function ($)
{
$.myNamespace.MyClass = {
m_varIWantToCommentOn: null,
/// <summary locid="m_varIWantToCommentOn">
/// *This doesn't work here* How should I comment on what this var is for?
/// </summary>
Init: function ()
{
/// <summary locid="Init">
/// Called when MyClass is initialized for the first time. this comment works fine.
/// </summary>
// ...use m_varIWantToCommentOn in some way...
}
}
})(jQuery);
I know this question is kind of old, but in case someone else has the same question...
I would use the <field> tag. It goes above the field it describes, unlike function documentation which goes on the inside.
(function ($) {
$.myNamespace.MyClass = {
/// <field> comments here </field>
m_varIWantToCommentOn: null,
Init: function () {
/// <summary locid="Init">
/// Called when MyClass is initialized for the first time. this comment works fine.
/// </summary>
// ...use m_varIWantToCommentOn in some way...
}
}
})(jQuery);
Typically, <var> tags are only used in var declarations, but they also go above the var they describe.
/// <var>comments here</var>
var someVar = null,
/// <var>This is a number</var>
anotherVar = 0;