templates

Windows batch parse template and increment values

Hi, I'm trying to write a windows batch file that would read in a text file with certain text in it and increment some values in that file. The text file would contain text like : public static const COUNTER:int = 0 the batch file would then search for "COUNTER:int = 0" and increment the 0 value. Unfortunately my knowledge of windo...

Storing values of any type as type initially supplied in templated factory method in C++?

This is a slightly different question to this one ([http://stackoverflow.com/questions/1566445/accessing-a-method-from-a-templated-derived-class-without-using-virtual-functions%5D%5B1%5D) which I asked recently. I would like to create an instance of an object using a templated factory method, then from then on only be able to set and ge...

Smarty PHP/template output problem

I have problem outputing this to page.. for ( $i = 0; $mainarray[$i] != ''; $i++ ){ $query = mysql_query("SELECT ... FROM ... WHERE id=$i") or die(mysql_error()); while($tmp = mysql_fetch_assoc($query)) { $something[] = $tmp; } $smarty->assign('stuff'.$i, $something); } I could manualy do it like {section name=i loop=$stuff1...

Templated parameter for a template specialisation?

Hi I've got a static member of a templated class that I want defined for a sub group of classes that are templated ie: template <typename T> class FooT { private: static int ms_id; }; template <typename T> class Foo {}; template<> template<typename T> int FooT< template Foo<T> >::ms_id = 10; Sadly this throws the following error ...

How to pass paramater into code-template in eclipse-plugin

I want to create a plugin which defines a new code template (like this blog post). How can I pass a parameter into the template? like ${name:param}? ...

porting template to zend framework

Hi, I got few issues proting a pear based form to zend form. I have few elements I need : Basic Elements Groups Group Elements Sections I previously used templates to render the forms on Pear. I obviously cannot use pre-existing zend decorators, since I need to specify css classes for each of the components of my base elements. To ...

Exporting template code = dangerous? (MSVC)

As I noted in another SO question, I came across this article. The issue came up when I compiled boost 1.40 via MSVC7.1 and several C4251 warnings popped up. Now, after reading said article, I wonder: Is it generally discouraged to export template code, e.g. class DLLEXPORT_MACRO AClass { public: std::vector<int> getVecCopy() { retu...

Templates for AS3 (like c++)

How do I define C++-like templates in AS3?; I have a map class (2d array) that I want to re-use across projects but the cell data is a different class depending on the project or implementation; There are a bunch of other reasons regarding sharing code accross different implementations, but I'd hope for somthing like: map = new MyMap<M...

pimpl idiom and template class friend

I'm trying to use the pimpl idiom to hide some grungy template code, but I can't give derived classes of the body class friend access to the handle class. I get an error C2248 from MSVC 9 sp1. Here's some code to duplicate the error: // // interface.hpp // namespace internal{ template<class T> class specific_body; } class int...

Blogger template: Style blog post based on label

Hello, I'm trying to change the style of a blog post (for instance change the title color), based on the labels associated to the post. I'm a bit new to the templating, so I though I would be going to add a class with the label in the title <h3> element, and then add my CSS rules. So I found this which would generate a proper list of ...

Templated Stl Containers

template <class T> class container { typedef list<T> ObjectList; public: ~container () { for (typename ObjectList::iterator item = _Container.begin(); item != _Container.end(); item++) { if (*item) delete (*item) } } } how can i free the container items by ...

Plugable Email Templating solution for C#

Is anyone aware of a plugable Email Templating solution for C#? I've grown weary of having to roll my own each project and I imagine there are more robust solutions out there. It should support HTML/non-HTML and allow for tokens (e.g. USERNAME is replaced with a configurable value). ...

C++ template programming question expected `;' before ‘it’ ?

I am writting a small piece of code exercising policy-based template programming. In this program, a CDecayer class is defined and it uses DecayerPolicy as its policy class. However the compiler complained that " expected `;' before ‘it’ " about the CDecayer part . Any suggestions? #include <iostream> #include <vector> #include <map> #...

Class 'is not a template type'

What does this error mean? Generic.h:25: error: 'Generic' is not a template type Here's Generic. template <class T> class Generic: public QObject, public CFG, public virtual Evaluator { Q_OBJECT std::string key_; std::vector<std::string> layouts_; std::vector<std::string> static_widgets_; std::map<std::string, std...

Template classes and their methods

Linking my program produces a bunch of errors like below. /home/starlon/Projects/LCDControl/DrvQt.cpp:8: undefined reference to `Generic<LCDText>::Generic(Json::Value*, int)' /home/starlon/Projects/LCDControl/DrvQt.cpp:18: undefined reference to `Generic<LCDText>::~Generic()' /home/starlon/Projects/LCDControl/DrvQt.cpp:8: undefined refe...

Can one leverage std::basic_string to implement a string having a length limitation?

I'm working with a low-level API that accepts a char* and numeric value to represent a string and its length, respectively. My code uses std::basic_string and calls into these methods with the appropriate translation. Unfortunately, many of these methods accept string lengths of varying size (i.e. max(unsigned char), max(short), etc......

Good Site Builder

Hi, I am currently working on a website and i kinda need something like a cms/site builder to be integrated int the site, but not very complicated. for example let's say i have a few templates and the users can modify them as they please(add a picture, some text, etc) Please help. Thank you! ...

Parsing Dreamweaver templates with Regular Expressions

I have a requirement to parse the content out of Dreamweaver templates. I'm using C#. Here is some example content that I will need to parse. <div id="myDiv"> <h1><!-- InstanceBeginEditable name="PageHeading" --> The Heading<!-- InstanceEndEditable --></h1> <!-- InstanceBeginEditable name="PageContent" --> <p> Lorem...

Why is non-type template parameter expression handling inconsistent across compilers?

Here is something I observed across various compilers. It seems there are compiler bugs. template <int I> struct X { }; int main(void) { X<(16 > 1)> a; // Works on vc9, works on g++ 4.1.2, works on Comeau 4.3.10.1 X<(int(16) > 1)> b; // Works on vc9, works on g++ 4.1.2, works on Comeau 4.3.10.1 X<(16 >> 1)> c; // Work...

Good C++ Debugging/IDE Environment for Linux?

I have a friend who is trying to make the switch to Linux, but is hung up on the apparent lack of debugging/IDE environments for C++, especially as they relate to template programming. He has been using visual studio for years and is maybe a little spoiled by their awesome IDE. Does anyone have any good suggestions for an environment whe...