//-------------------------------------------------------------------------- int CLI::add_policy(const std::string& filename) { ZenLib::Ztring z_filename = ZenLib::Ztring().From_UTF8(filename); if (!ZenLib::File::Exists(z_filename)) return -1; ZenLib::File file(z_filename); ZenLib::int64u size = file.Size_Get(); if (size == (ZenLib::int64u)-1) return -1; ZenLib::int8u* Buffer = new ZenLib::int8u[size + 1]; size_t len = file.Read(Buffer, size); Buffer[len] = '\0'; ZenLib::Ztring FromFile; FromFile.From_UTF8((char*)Buffer); if (FromFile.empty()) FromFile.From_Local((char*)Buffer); file.Close(); policies.push_back(FromFile.To_UTF8()); delete [] Buffer; return 0; }
//-------------------------------------------------------------------------- int CLI::register_option(const std::string& opt) { std::string report; if (MCL.add_option(opt, report) < 0) { ZenLib::Ztring str; str.From_UTF8(report); STRINGOUT(str); if (report == "Option not known") return CLI_RETURN_ERROR; return CLI_RETURN_FINISH; } return CLI_RETURN_NONE; }