// // aegis - project change supervisor // Copyright (C) 2014 Peter Miller // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 3 of the License, or (at // your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License along // with this program. If not, see . // #include #include #include iformat_cpio::~iformat_cpio() { trace(("%s\n", __PRETTY_FUNCTION__)); } iformat_cpio::iformat_cpio(const input::pointer &a_deeper) : iformat(a_deeper), cpio_p(input_cpio::create(a_deeper)) { trace(("%s\n", __PRETTY_FUNCTION__)); } iformat_cpio::pointer iformat_cpio::create(const input::pointer &a_deeper) { trace(("%s\n", __PRETTY_FUNCTION__)); return pointer(new iformat_cpio(a_deeper)); } bool iformat_cpio::candidate(const input::pointer &ifp) { trace(("%s\n", __PRETTY_FUNCTION__)); return input_cpio::candidate(ifp); } iformat::token_t iformat_cpio::get_token_inner(nstring &name, input::pointer &value) { trace(("%s\n", __PRETTY_FUNCTION__)); nstring member_name; value = cpio_p->child(member_name); if (!value) { trace(("end of file")); name = "eof of input"; value = input_null::create(); return token_eof; } trace(("member_name = %s\n", member_name.quote_c().c_str())); if (member_name == "etc/project-name") return token_project_name; if (member_name == "etc/change-number") return token_change_number; if (member_name == "etc/change-set") return token_meta_data; if (member_name.starts_with("etc/partition")) return token_partition; if (member_name.starts_with("patch/")) { name = member_name.substr(6, member_name.size() - 6); return token_patch; } if (member_name.starts_with("src/")) { name = member_name.substr(4, member_name.size() - 4); return token_source; } fatal_error ( "cpio archive member %s unexpected", member_name.quote_c().c_str() ); return token_eof; } // vim: set ts=8 sw=4 et :