[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kdoc
Subject:    Explicitely specialized template classes
From:       Wolfgang Bangerth <Wolfgang.Bangerth () IWR ! Uni-Heidelberg ! De>
Date:       1999-12-23 15:41:26
[Download RAW message or body]


Hi there,
one last patch before christmas: I have a file like this (well, I have
many of them, this is just one example)

  template <int dim>
  class X {};

  template <>
  class X<1> {};
(i.e. X has a general template, but whenever I want a X<1>, then the
explicitely specialized one is taken).

I would like the explicit template parameter to show up in the class name,
i.e. one class X, another class X<1>. The following patch (today using -u)
does this:

--- kdoc        Thu Dec 23 16:20:37 1999
+++ kdoc.4      Mon Dec 13 16:51:59 1999
@@ -548,15 +548,11 @@
        }
 
        # Class/Struct
-       elsif ( $decl =~ /^\s*((?:template\s*<.*>)?)      # 1 template
-                       \s*(class|struct|union|namespace) # 2 struct type
-                       \s+([\w_]+                        # 3 name
-                           (?:<[\w_ :,]+?>)?             #   maybe explicit template
-                                                         #    (eat chars between <> non-hungry)
-                           (?:::[\w_]+)*                 #   maybe nested
-                           )
-                       (.*?)                             # 4 inheritance
-                       ([;{])/xs ) {                     # 5 rest
+       elsif ( $decl =~ /^\s*((?:template\s*<.*>)?)    # template
+                       \s*(class|struct|union|namespace) # struct type
+                       \s+([-\w_]+(?:::[-\w_]+)*)      # name
+                       (.*?)                           # inheritance
+                       ([;{])/xs ) {
 
                print "Class: [$1]\n\t[$2]\n\t[$3]\n\t[$4]\n\t[$5]\n" if  $debug;


This thing has one unfortunate drawback: for the class X<1>, a similar
file is created, i.e. one would have to escape file names properly. I have
not done this yet, but I can do it if you want me to, Taj.

Ah, and I still have one more patch in my Santa Claus bag: the foot line
usually fails for me (my user name is not printed, only 
  'generated by @atlas ...'
The reason is that we do not have whoami installed. But we have 'who am
i', so this might or might not be a good patch:

--- kdocCxxHTML.pm      Thu Dec 23 16:31:43 1999
+++ kdocCxxHTML.pm.2    Wed Dec  8 13:10:29 1999
@@ -31,15 +31,7 @@
        @docQueue = ();
 
        $host = `uname -n`;     chop $host;
-
-       # to get the user name: try 'whoami'...
-       if ( $who = `whoami` ) {
-           chop $who;
-       } else {
-           # ... and if that fails, use first word of 'who am i'
-           $who = (split (/ /, `who am i`))[0];
-       }
-
+       $who = `whoami`;        chop $who;
        $now = localtime;
        $gentext = "$who\@$host on $now, using kdoc $main::Version.";
 

I wish everyone a pleasant time over the next days. Heidelberg is covered
under approx. 30cm of snow, so that makes it feel very much like
Christmas. I image that for most of you others on this list (Marcin,
Rainer, ...) things are similar -- and Taj, just enjoy a handful of white
sand instead ;-)

Regards
  Wolfgang

-------------------------------------------------------------------------
Wolfgang Bangerth          email: wolfgang.bangerth@iwr.uni-heidelberg.de
                             www: http://gaia.iwr.uni-heidelberg.de/~wolf

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic