attribute-rel-svg.cpp revision 6093ffd39c5580cfcd4e151cc6069cb94170a08b
/*
*
* Created on: Jul 25, 2011
* Author: abhishek
*/
/** \class SPAttributeRelSVG
*
* SPAttributeRelSVG class stores the mapping of element->attribute
* relationship and provides a static function to access that
* mapping indirectly(only reading).
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <fstream>
#include <sstream>
#include <string>
#include "attribute-rel-svg.h"
#include "path-prefix.h"
#include "preferences.h"
bool SPAttributeRelSVG::foundFile = false;
/*
* This functions checks whether an element -> attribute pair is allowed or not
*/
{
}
// Always valid if data file not found!
if( !foundFile ) return true;
// Strip of "svg:" from the element's name
}
// Check for attributes with -, role, aria etc. to allow for more accessbility
if (attribute[0] == '-'
return true;
} else {
//g_warning( "Invalid attribute: %s used on <%s>", attribute.c_str(), element.c_str() );
return false;
}
}
/*
* One timer singleton constructor, to load the element -> attributes data
* into memory.
*/
{
// Read data from standard path
filepath += "/svgprops";
if (!f.is_open()) {
// Display warning for file not open
g_warning("Could not open the data file for XML attribute-element map construction: %s", filepath.c_str());
f.close();
return ;
}
foundFile = true;
while (!f.eof()){
if(s.size() > 0 && s[0] != '\n'){
getline(f,s);
ss << s;
element = s;
}
}
}
f.close();
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :