I have a C++ program that parses and writes to XML files. Since the tags used in XML files are repetitive, I've declared a list of common strings as tags in CPP file itself. Should I create a separate header file for the strings alone or is it fine leaving them in the implementation file itself? Which is the best practice here?
Here is what my CPP file looks like:
#include<iostream>
#include<string>
const std::string POS_ID = "position-id-map";
const std::string HEIGHT = "height";
const std::string WIDTH = "width";
const std::string RATIO = "ratio";
.
.
.
.
//20 more strings
int main(int argc, char ** argv) {
//do XML reading and other stuff
return 0;
}
What benefit will declaring it in a separate header file give me over declaring it directly in the implementation file?