Exemple #1
0
std::vector<ProcwatcherIMV::prop_type> ProcwatcherIMV::readAllProperties(std::istream &in)
{
    std::vector<prop_type> properties;

    in.clear();
    in.seekg(0, std::ios::beg);

    unsigned int buf_len = 1024;
    char buf[buf_len];
    int readfh = 0;
    std::string filename, hash;

    while (readLine(in, buf, buf_len)) {
        std::string line(buf);

        //		/* ignore comments */
        //		if (line.size()<1 || line.at(0)=='#')
        //			continue;
        //
        //        /*
        //         * the format of the policy file should be :
        //         *   # here is the comment
        //         *   f=
        //         *   h=
        //         *   ...
        //         * f means filename, h means hash
        //         */ 
        //        size_t pos = line.find_first_of('=');
        //
        //        /* ignore illegal lines */
        //        if (pos == std::string::npos)
//        	continue;
//
        if(!readfh)
            /* get filename*/
            filename = line;
        else
            /* get hash */
            hash = line;

        readfh ^= 1;

        if(readfh) continue;

        /* debug */
        LOG4CXX_DEBUG(logger, "filename:\"" << filename  << "\" hash:\"" << hash << "\"");

        /* add key-value-pair */
        properties.push_back( prop_type (filename, hash) );
    }

    return properties;
}
Exemple #2
0
TCOD_value_type_t structrecord_get_prop_type(StructRecord sr, char *name) {
  Prop p = structrecord_get_prop_named(sr, name);
  return p ? prop_type(p) : TCOD_TYPE_NONE;
}