| 1452 | } |
| 1453 | |
| 1454 | void ClassCompiler::CompileStream(const std::string& path, std::istream& input, |
| 1455 | std::ostream& oimpl, std::ostream& oheader) |
| 1456 | { |
| 1457 | input.exceptions(std::istream::badbit); |
| 1458 | |
| 1459 | std::string guard_name = FileNameToGuardName(BaseName(path)); |
| 1460 | |
| 1461 | oheader << "#ifndef " << guard_name << std::endl |
| 1462 | << "#define " << guard_name << std::endl << std::endl; |
| 1463 | |
| 1464 | oheader << "#include \"base/object.hpp\"" << std::endl |
| 1465 | << "#include \"base/type.hpp\"" << std::endl |
| 1466 | << "#include \"base/value.hpp\"" << std::endl |
| 1467 | << "#include \"base/array.hpp\"" << std::endl |
| 1468 | << "#include \"base/atomic.hpp\"" << std::endl |
| 1469 | << "#include \"base/dictionary.hpp\"" << std::endl |
| 1470 | << "#include <boost/signals2.hpp>" << std::endl << std::endl; |
| 1471 | |
| 1472 | oimpl << "#include \"base/exception.hpp\"" << std::endl |
| 1473 | << "#include \"base/objectlock.hpp\"" << std::endl |
| 1474 | << "#include \"base/utility.hpp\"" << std::endl |
| 1475 | << "#include \"base/convert.hpp\"" << std::endl |
| 1476 | << "#include \"base/debug.hpp\"" << std::endl |
| 1477 | << "#include \"base/dependencygraph.hpp\"" << std::endl |
| 1478 | << "#include \"base/logger.hpp\"" << std::endl |
| 1479 | << "#include \"base/function.hpp\"" << std::endl |
| 1480 | << "#include \"base/configobject.hpp\"" << std::endl |
| 1481 | << "#include \"base/configtype.hpp\"" << std::endl; |
| 1482 | |
| 1483 | #ifdef _MSC_VER |
| 1484 | oimpl << "#pragma warning( push )" << std::endl |
| 1485 | << "#pragma warning( disable : 4244 )" << std::endl |
| 1486 | << "#pragma warning( disable : 4800 )" << std::endl; |
| 1487 | #elif defined(__GNUC__) && !defined(__clang__) |
| 1488 | oimpl << "#pragma GCC diagnostic push" << std::endl |
| 1489 | << "#pragma GCC diagnostic ignored \"-Wunused-parameter\"" << std::endl |
| 1490 | << "#pragma GCC diagnostic ignored \"-Wunused-variable\"" << std::endl; |
| 1491 | #elif defined(__clang__) |
| 1492 | oimpl << "#pragma clang diagnostic push" << std::endl |
| 1493 | << "#pragma clang diagnostic ignored \"-Wunused-parameter\"" << std::endl |
| 1494 | << "#pragma clang diagnostic ignored \"-Wunused-variable\"" << std::endl; |
| 1495 | #endif /* _MSC_VER */ |
| 1496 | |
| 1497 | ClassCompiler ctx(path, input, oimpl, oheader); |
| 1498 | ctx.Compile(); |
| 1499 | |
| 1500 | oheader << "#endif /* " << guard_name << " */" << std::endl; |
| 1501 | |
| 1502 | #ifdef _MSC_VER |
| 1503 | oimpl << "#pragma warning ( pop )" << std::endl; |
| 1504 | #elif defined(__GNUC__) && !defined(__clang__) |
| 1505 | oimpl << "#pragma GCC diagnostic pop" << std::endl; |
| 1506 | #elif defined(__clang__) |
| 1507 | oimpl << "#pragma clang diagnostic pop" << std::endl; |
| 1508 | #endif /* _MSC_VER */ |
| 1509 | } |