string processing in custom file templates
string processing in custom file templates
- Subject: string processing in custom file templates
- From: email@hidden
- Date: Wed, 25 Feb 2004 15:18:11 -0800
So I started playing around with custom file templates, copying from
/Library/Application Support/Apple/Developer Tools/File
Templates/Carbon/C++ Class.pbfiletemplate
into my own
~/Library/Application Support/Apple/Developer Tools/File
Templates/BSD/C++ Class.pbfiletemplate
First I have to say the way Apple has made it so easy to add in one's
own templates, even adding the appropriate levels in the hierarchy
(e.g. the installed file templates have no 'BSD' group, but one is
added automatically based on detected directory hierarchy) is
completely seamless and slick. My thanks and congratulations.
Now...
...inside the .h file there are these groovy \302 \253 and \302 \273
sequences that surround strings like FILENAME, PROJECTNAME,
FULLUSERNAME, DATE, YEAR, ORGANIZATIONNAME and so on. I have two
questions:
(1) is there a list of these special strings and their meanings
somewhere?
(2) this is a stretch, I know, but are there hooks into how the string
substitution happens?
What I'd ideally like to do with string substitution is, for the .h
file included in my C++ Class.pbfiletemplate, to take FILENAME, turn
studly capitalization into underscore breaks, capitalize the result,
strip off any trailing .h, and append _H, and wrap the result in double
underscores. Better explained by example:
StudlyCaps.h -> __STUDLY_CAPS_H__
the obvious intent being to automatically generate the boilerplate
#ifndef __STUDLY_CAPS_H__
#define __STUDLY_CAPS_H__
#endif // __STUDLY_CAPS_H__
wrapper. (I need to target not just OS X, nor just GCC, but other,
older C compilers as well; so no #import for me.)
In the meantime I'm just generating preprocessor macros that look like
#ifndef StudlyCaps.h
#define StudlyCaps.h
#endif // StudlyCaps.h
and praying the compiler won't mind. It doesn't seem to.
Thanks much for any advice or tips.
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.