Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ender land

macrumors 6502a
Original poster
Oct 26, 2010
876
0
Hello everyone!

I have been using XCode for a while now and would like to see what other people can do on this front. I modified my template .h file to do something similar to the following (for a file called Molecule.h):

#ifndef Molecule.h
#define Molecule.h



#endif

Unfortunately I have to manually change the ".h" to be "_h" each time I create new files. Considerably less work than adding all that information manually but still annoying.

Does anyone have a quick way to do that?

The file I will modify contains the following text, modified from original content:
#ifndef «FILENAME»
#define «FILENAME»

/*
* «FILENAME»
* «PROJECTNAME»
*
* Created by «FULLUSERNAME» on «DATE».
* Copyright «YEAR» «ORGANIZATIONNAME». All rights reserved.
*
*/


#endif
I am unsure how to manipulate the above to take the file name (without path).

I have struggled a fair bit to find documentation on this online so any advice would be greatly appreciated!

Thanks,
ender
 
Prehaps try this:

Code:
#ifndef «FILEBASENAMEASIDENTIFIER»_H
#define «FILEBASENAMEASIDENTIFIER»_H


#endif
 
For reference:
http://www.cocoadev.com/index.pl?XcodeProjectTemplates

Found by entering the following into google:
xcode template

One of google's suggestions for search terms was:
xcode template macros

The results of that search have the above URL in the top 10 hits.


Alternatively, using some of the names from the example itself, I searched for:
xcode ORGANIZATIONNAME FILENAME

The URL again shows up, this time in the top 5 results.
 
For reference:
http://www.cocoadev.com/index.pl?XcodeProjectTemplates

Found by entering the following into google:
xcode template

One of google's suggestions for search terms was:
xcode template macros

The results of that search have the above URL in the top 10 hits.


Alternatively, using some of the names from the example itself, I searched for:
xcode ORGANIZATIONNAME FILENAME

The URL again shows up, this time in the top 5 results.

Wow, thanks - I definitely missed that when searching before...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.