diff options
author | Michi Henning <michi@zeroc.com> | 2008-10-17 17:04:16 +1000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2008-10-17 17:04:16 +1000 |
commit | 4259685e44589a6efbb45f43f054b406dc8cf89c (patch) | |
tree | d3e26a8201d782e4cd4f617c090cafe9e609d943 /cpp/src | |
parent | Changed swish-e perl scripts to tolerate -IceTouch suffix and to avoid (diff) | |
parent | Squashed commit of the following: (diff) | |
download | ice-4259685e44589a6efbb45f43f054b406dc8cf89c.tar.bz2 ice-4259685e44589a6efbb45f43f054b406dc8cf89c.tar.xz ice-4259685e44589a6efbb45f43f054b406dc8cf89c.zip |
Merge branch 'R3_3_branch'
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/OutgoingAsync.cpp | 8 | ||||
-rw-r--r-- | cpp/src/IceGrid/Allocatable.cpp | 9 | ||||
-rw-r--r-- | cpp/src/IceGrid/LocatorI.cpp | 20 | ||||
-rw-r--r-- | cpp/src/IceGrid/NodeCache.cpp | 5 | ||||
-rw-r--r-- | cpp/src/IceGrid/NodeCache.h | 1 | ||||
-rw-r--r-- | cpp/src/IceGrid/NodeI.cpp | 212 | ||||
-rw-r--r-- | cpp/src/IceGrid/NodeI.h | 24 | ||||
-rw-r--r-- | cpp/src/IceGrid/NodeSessionManager.cpp | 2 | ||||
-rw-r--r-- | cpp/src/IceGrid/ServerAdapterI.cpp | 15 | ||||
-rw-r--r-- | cpp/src/IceGrid/ServerI.cpp | 30 | ||||
-rw-r--r-- | cpp/src/IceGrid/SessionManager.h | 14 | ||||
-rwxr-xr-x | cpp/src/ca/iceca | 4 | ||||
-rw-r--r-- | cpp/src/slice2html/Gen.cpp | 91 | ||||
-rw-r--r-- | cpp/src/slice2html/Gen.h | 6 |
14 files changed, 347 insertions, 94 deletions
diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp index 14da19924e7..788cb2cb373 100644 --- a/cpp/src/Ice/OutgoingAsync.cpp +++ b/cpp/src/Ice/OutgoingAsync.cpp @@ -174,7 +174,7 @@ IceInternal::OutgoingAsyncMessageCallback::__warning(const std::exception& exc) { if(__os) // Don't print anything if release() was already called. { - __warning(__os->instance()); + __warning(__os->instance(), exc); } } @@ -187,7 +187,7 @@ IceInternal::OutgoingAsyncMessageCallback::__warning(const InstancePtr& instance const Exception* ex = dynamic_cast<const Exception*>(&exc); if(ex) { - out << "Ice::Exception raised by AMI callback:\n" << ex; + out << "Ice::Exception raised by AMI callback:\n" << *ex; } else { @@ -434,7 +434,7 @@ IceInternal::OutgoingAsync::__finished(const Ice::LocalException& exc) } void -IceInternal::OutgoingAsync::__finished(const LocalExceptionWrapper& ex) +IceInternal::OutgoingAsync::__finished(const LocalExceptionWrapper& exc) { assert(__os && !_sent); @@ -446,7 +446,7 @@ IceInternal::OutgoingAsync::__finished(const LocalExceptionWrapper& ex) try { - handleException(ex); // This will throw if the invocation can't be retried. + handleException(exc); // This will throw if the invocation can't be retried. } catch(const Ice::LocalException& ex) { diff --git a/cpp/src/IceGrid/Allocatable.cpp b/cpp/src/IceGrid/Allocatable.cpp index e078564d5a5..666d7c84cb7 100644 --- a/cpp/src/IceGrid/Allocatable.cpp +++ b/cpp/src/IceGrid/Allocatable.cpp @@ -38,7 +38,14 @@ AllocationRequest::pending() if(_timeout > 0) { - _session->getTimer()->schedule(this, IceUtil::Time::milliSeconds(_timeout)); + try + { + _session->getTimer()->schedule(this, IceUtil::Time::milliSeconds(_timeout)); + } + catch(const IceUtil::Exception&) + { + // Ignore, timer is destroyed because of shutdown + } } _state = Pending; return true; diff --git a/cpp/src/IceGrid/LocatorI.cpp b/cpp/src/IceGrid/LocatorI.cpp index 554a170c22d..3fbe3a146f1 100644 --- a/cpp/src/IceGrid/LocatorI.cpp +++ b/cpp/src/IceGrid/LocatorI.cpp @@ -236,12 +236,15 @@ LocatorI::Request::activate(const string& id) // NOTE: we use a timeout large enough to ensure that the activate() call won't // timeout if the server hangs in deactivation and/or activation. // - for(LocatorAdapterInfoSeq::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p) { - if(p->id == id) + Lock sync(*this); + for(LocatorAdapterInfoSeq::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p) { - _locator->activate(*p, this); - _activating.insert(id); + if(p->id == id) + { + _locator->activate(*p, this); + _activating.insert(id); + } } } @@ -684,7 +687,14 @@ LocatorI::removePendingResolve(const string& adapterId, int roundRobinCount) // if(roundRobinCount > 0) { - _database->getAdapter(adapterId)->increaseRoundRobinCount(roundRobinCount); + try + { + _database->getAdapter(adapterId)->increaseRoundRobinCount(roundRobinCount); + } + catch(const Ice::Exception&) + { + // Ignore. + } } map<string, deque<Ice::AMD_Locator_findAdapterByIdPtr> >::iterator p = _resolves.find(adapterId); diff --git a/cpp/src/IceGrid/NodeCache.cpp b/cpp/src/IceGrid/NodeCache.cpp index 812cb1977df..b9b8b478243 100644 --- a/cpp/src/IceGrid/NodeCache.cpp +++ b/cpp/src/IceGrid/NodeCache.cpp @@ -781,7 +781,10 @@ NodeEntry::checkSession() const while(_registering) { - wait(); + if(!timedWait(IceUtil::Time::seconds(5))) + { + break; // Consider the node down if it doesn't respond promptly. + } } if(!_session) diff --git a/cpp/src/IceGrid/NodeCache.h b/cpp/src/IceGrid/NodeCache.h index f47ede772e3..2fb6fa9ee13 100644 --- a/cpp/src/IceGrid/NodeCache.h +++ b/cpp/src/IceGrid/NodeCache.h @@ -45,7 +45,6 @@ public: void addServer(const ServerEntryPtr&); void removeServer(const ServerEntryPtr&); void setSession(const NodeSessionIPtr&); - void setSavedProxy(const NodePrx&); NodePrx getProxy() const; InternalNodeInfoPtr getInfo() const; diff --git a/cpp/src/IceGrid/NodeI.cpp b/cpp/src/IceGrid/NodeI.cpp index 4328a4aef85..b721c553271 100644 --- a/cpp/src/IceGrid/NodeI.cpp +++ b/cpp/src/IceGrid/NodeI.cpp @@ -188,6 +188,137 @@ private: string _dest; }; +class NodeUp : public NodeI::Update, public AMI_NodeObserver_nodeUp +{ +public: + + NodeUp(const NodeIPtr& node, const NodeObserverPrx& observer, NodeDynamicInfo info) : + Update(node, observer), _info(info) + { + } + + virtual void + send() + { + try + { + _observer->nodeUp_async(this, _info); + } + catch(const Ice::LocalException&) + { + finished(false); + } + } + + virtual void + ice_response() + { + finished(true); + } + + virtual void + ice_exception(const Ice::Exception&) + { + finished(false); + } + +private: + + NodeDynamicInfo _info; +}; + +class UpdateServer : public NodeI::Update, public AMI_NodeObserver_updateServer +{ +public: + + UpdateServer(const NodeIPtr& node, const NodeObserverPrx& observer, ServerDynamicInfo info) : + NodeI::Update(node, observer), _info(info) + { + } + + virtual void + send() + { + try + { + _observer->updateServer_async(this, _node->getName(), _info); + } + catch(const Ice::LocalException&) + { + finished(false); + } + } + + virtual void + ice_response() + { + finished(true); + } + + virtual void + ice_exception(const Ice::Exception&) + { + finished(false); + } + +private: + + ServerDynamicInfo _info; +}; + +class UpdateAdapter : public NodeI::Update, public AMI_NodeObserver_updateAdapter +{ +public: + + UpdateAdapter(const NodeIPtr& node, const NodeObserverPrx& observer, AdapterDynamicInfo info) : + NodeI::Update(node, observer), _info(info) + { + } + + virtual void + send() + { + try + { + _observer->updateAdapter_async(this, _node->getName(), _info); + } + catch(const Ice::LocalException&) + { + finished(false); + } + } + + virtual void + ice_response() + { + finished(true); + } + + virtual void + ice_exception(const Ice::Exception&) + { + finished(false); + } + +private: + + AdapterDynamicInfo _info; +}; + +} + +NodeI::Update::Update(const NodeIPtr& node, const NodeObserverPrx& observer) : _node(node), _observer(observer) +{ +} + +NodeI::Update::~Update() +{ +} + +void +NodeI::Update::finished(bool success) +{ + _node->dequeueUpdate(_observer, this, !success); } NodeI::NodeI(const Ice::ObjectAdapterPtr& adapter, @@ -847,6 +978,8 @@ NodeI::addObserver(const NodeSessionPrx& session, const NodeObserverPrx& observe assert(_observers.find(session) == _observers.end()); _observers.insert(make_pair(session, observer)); + _observerUpdates.erase(observer); // Remove any updates from the previous session. + ServerDynamicInfoSeq serverInfos; AdapterDynamicInfoSeq adapterInfos; for(map<string, ServerDynamicInfo>::const_iterator p = _serversDynamicInfo.begin(); @@ -863,19 +996,11 @@ NodeI::addObserver(const NodeSessionPrx& session, const NodeObserverPrx& observe adapterInfos.push_back(q->second); } - try - { - NodeDynamicInfo info; - info.info = _platform.getNodeInfo(); - info.servers = serverInfos; - info.adapters = adapterInfos; - observer->nodeUp(info); - } - catch(const Ice::LocalException& ex) - { - Ice::Warning out(_traceLevels->logger); - out << "unexpected observer exception:\n" << ex; - } + NodeDynamicInfo info; + info.info = _platform.getNodeInfo(); + info.servers = serverInfos; + info.adapters = adapterInfos; + queueUpdate(observer, new NodeUp(this, observer, info)); } void @@ -910,15 +1035,7 @@ NodeI::observerUpdateServer(const ServerDynamicInfo& info) { if(sent.find(p->second) == sent.end()) { - try - { - p->second->updateServer(_name, info); - sent.insert(p->second); - } - catch(const Ice::LocalException&) - { - // IGNORE - } + queueUpdate(p->second, new UpdateServer(this, p->second, info)); } } } @@ -948,18 +1065,53 @@ NodeI::observerUpdateAdapter(const AdapterDynamicInfo& info) { if(sent.find(p->second) == sent.end()) { - try - { - p->second->updateAdapter(_name, info); - } - catch(const Ice::LocalException&) - { - // IGNORE - } + queueUpdate(p->second, new UpdateAdapter(this, p->second, info)); } } } +void +NodeI::queueUpdate(const NodeObserverPrx& proxy, const UpdatePtr& update) +{ + //Lock sync(*this); Called within the synchronization + deque<UpdatePtr>& queue = _observerUpdates[proxy]; + queue.push_back(update); + if(queue.size() == 1) + { + queue.front()->send(); + } +} + +void +NodeI::dequeueUpdate(const NodeObserverPrx& proxy, const UpdatePtr& update, bool all) +{ + IceUtil::Mutex::Lock sync(_observerMutex); + map<NodeObserverPrx, deque<UpdatePtr> >::iterator p = _observerUpdates.find(proxy); + if(p == _observerUpdates.end() || p->second.front().get() != update.get()) + { + return; + } + + deque<UpdatePtr>& queue = p->second; + if(all) + { + queue.clear(); + } + else + { + queue.pop_front(); + } + + if(!queue.empty()) + { + queue.front()->send(); + } + else + { + _observerUpdates.erase(p); + } +} + void NodeI::addServer(const ServerIPtr& server, const string& application) { diff --git a/cpp/src/IceGrid/NodeI.h b/cpp/src/IceGrid/NodeI.h index 36ac0019c0e..6ecb9df70a8 100644 --- a/cpp/src/IceGrid/NodeI.h +++ b/cpp/src/IceGrid/NodeI.h @@ -35,9 +35,29 @@ typedef IceUtil::Handle<ServerCommand> ServerCommandPtr; class NodeSessionManager; +class NodeI; +typedef IceUtil::Handle<NodeI> NodeIPtr; + class NodeI : public Node, public IceUtil::Monitor<IceUtil::Mutex> { public: + class Update : virtual public IceUtil::Shared + { + public: + + Update(const NodeIPtr&, const NodeObserverPrx&); + virtual ~Update(); + + virtual void send() = 0; + + void finished(bool); + + protected: + + const NodeIPtr _node; + const NodeObserverPrx _observer; + }; + typedef IceUtil::Handle<Update> UpdatePtr; NodeI(const Ice::ObjectAdapterPtr&, NodeSessionManager&, const ActivatorPtr&, const IceUtil::TimerPtr&, const TraceLevelsPtr&, const NodePrx&, const std::string&, const UserAccountMapperPrx&); @@ -97,6 +117,8 @@ public: void removeObserver(const NodeSessionPrx&); void observerUpdateServer(const ServerDynamicInfo&); void observerUpdateAdapter(const AdapterDynamicInfo&); + void queueUpdate(const NodeObserverPrx&, const UpdatePtr&); + void dequeueUpdate(const NodeObserverPrx&, const UpdatePtr&, bool); void addServer(const ServerIPtr&, const std::string&); void removeServer(const ServerIPtr&, const std::string&); @@ -143,6 +165,8 @@ private: std::map<std::string, ServerDynamicInfo> _serversDynamicInfo; std::map<std::string, AdapterDynamicInfo> _adaptersDynamicInfo; + std::map<NodeObserverPrx, std::deque<UpdatePtr> > _observerUpdates; + IceUtil::Mutex _serversLock; std::map<std::string, std::set<ServerIPtr> > _serversByApplication; std::set<std::string> _patchInProgress; diff --git a/cpp/src/IceGrid/NodeSessionManager.cpp b/cpp/src/IceGrid/NodeSessionManager.cpp index 06ae7828d3f..066b144b0a9 100644 --- a/cpp/src/IceGrid/NodeSessionManager.cpp +++ b/cpp/src/IceGrid/NodeSessionManager.cpp @@ -581,7 +581,7 @@ NodeSessionManager::createdSession(const NodeSessionPrx& session) // for(vector<NodeSessionKeepAliveThreadPtr>::const_iterator p = sessions.begin(); p != sessions.end(); ++p) { - (*p)->tryCreateSession(true); + (*p)->tryCreateSession(true, IceUtil::Time::seconds(5)); } } diff --git a/cpp/src/IceGrid/ServerAdapterI.cpp b/cpp/src/IceGrid/ServerAdapterI.cpp index ba904bdf199..08ae0d9a441 100644 --- a/cpp/src/IceGrid/ServerAdapterI.cpp +++ b/cpp/src/IceGrid/ServerAdapterI.cpp @@ -96,6 +96,12 @@ ServerAdapterI::activate_async(const AMD_Adapter_activatePtr& cb, const Ice::Cur destroy(); activationFailed("server destroyed"); } + catch(const Ice::Exception& ex) + { + ostringstream os; + os << "unexpected exception: " << ex; + activationFailed(os.str()); + } } Ice::ObjectPrx @@ -188,7 +194,14 @@ ServerAdapterI::setDirectProxy(const Ice::ObjectPrx& prx, const Ice::Current&) void ServerAdapterI::destroy() { - _node->getAdapter()->remove(_this->ice_getIdentity()); + try + { + _node->getAdapter()->remove(_this->ice_getIdentity()); + } + catch(const Ice::LocalException&) + { + // Ignore. + } } void diff --git a/cpp/src/IceGrid/ServerI.cpp b/cpp/src/IceGrid/ServerI.cpp index c033ff18817..9879fc99ca7 100644 --- a/cpp/src/IceGrid/ServerI.cpp +++ b/cpp/src/IceGrid/ServerI.cpp @@ -357,7 +357,14 @@ void TimedServerCommand::startTimer() { _timerTask = new CommandTimeoutTimerTask(this); - _timer->schedule(_timerTask, IceUtil::Time::seconds(_timeout)); + try + { + _timer->schedule(_timerTask, IceUtil::Time::seconds(_timeout)); + } + catch(const IceUtil::Exception&) + { + // Ignore, timer is destroyed because node is shutting down. + } } void @@ -2514,7 +2521,14 @@ ServerI::setStateNoSync(InternalServerState st, const std::string& reason) if(_activation == Always) { _timerTask = new DelayedStart(this, _node->getTraceLevels()); - _node->getTimer()->schedule(_timerTask, IceUtil::Time::milliSeconds(500)); + try + { + _node->getTimer()->schedule(_timerTask, IceUtil::Time::milliSeconds(500)); + } + catch(const IceUtil::Exception&) + { + // Ignore, timer is destroyed because node is shutting down. + } } else if(_activation == Disabled && _disableOnFailure > 0 && _failureTime != IceUtil::Time()) { @@ -2526,8 +2540,16 @@ ServerI::setStateNoSync(InternalServerState st, const std::string& reason) // callback is executed. // _timerTask = new DelayedStart(this, _node->getTraceLevels()); - _node->getTimer()->schedule(_timerTask, - IceUtil::Time::seconds(_disableOnFailure) + IceUtil::Time::milliSeconds(500)); + try + { + _node->getTimer()->schedule(_timerTask, + IceUtil::Time::seconds(_disableOnFailure) + + IceUtil::Time::milliSeconds(500)); + } + catch(const IceUtil::Exception&) + { + // Ignore, timer is destroyed because node is shutting down. + } } } diff --git a/cpp/src/IceGrid/SessionManager.h b/cpp/src/IceGrid/SessionManager.h index 7760241e865..c598eadc2cd 100644 --- a/cpp/src/IceGrid/SessionManager.h +++ b/cpp/src/IceGrid/SessionManager.h @@ -189,7 +189,7 @@ public: } virtual void - tryCreateSession(bool waitForTry = true) + tryCreateSession(bool waitForTry = true, const IceUtil::Time& timeout = IceUtil::Time()) { { Lock sync(*this); @@ -215,7 +215,17 @@ public: // Wait until the action is executed and the state changes. while(_nextAction == Connect || _nextAction == KeepAlive || _state == InProgress) { - wait(); + if(timeout == IceUtil::Time()) + { + wait(); + } + else + { + if(!timedWait(timeout)) + { + break; + } + } } } } diff --git a/cpp/src/ca/iceca b/cpp/src/ca/iceca index a23892830ec..99173c7fdb4 100755 --- a/cpp/src/ca/iceca +++ b/cpp/src/ca/iceca @@ -315,10 +315,10 @@ if sys.argv[script] == "init": # Construct the DN for the CA certificate. DNelements = { \ 'C':['countryName', "Country name", "", 'match'], \ - 'ST':['stateOfProviceName', "State or province name", "", 'match'], \ + 'ST':['stateOrProvinceName', "State or province name", "", 'match'], \ 'L':['localityName', "Locality", "", 'match'], \ 'O':['organizationName', "Organization name", "GridCA-" + socket.gethostname(), 'match'], \ - 'OU':['organizationUnitName', "Organization unit name", "", 'optional'], \ + 'OU':['organizationalUnitName', "Organizational unit name", "", 'optional'], \ 'CN':['commonName', "Common name", "Grid CA", 'supplied'] \ } diff --git a/cpp/src/slice2html/Gen.cpp b/cpp/src/slice2html/Gen.cpp index 49ae1cbd617..f1e9e5b02e0 100644 --- a/cpp/src/slice2html/Gen.cpp +++ b/cpp/src/slice2html/Gen.cpp @@ -250,7 +250,6 @@ Slice::GeneratorBase::openDoc(const string& file, const string& title, const str { _out << h2; } - _indexFooter = getFooter(footer); _out.inc(); _out.inc(); } @@ -291,11 +290,11 @@ Slice::GeneratorBase::openDoc(const ContainedPtr& c) // Close an open HTML file after writing the footer. // void -Slice::GeneratorBase::closeDoc() +Slice::GeneratorBase::closeDoc(const string& footer) { _out.dec(); _out.dec(); - _out << nl << (!_indexFooter.empty() ? _indexFooter : _footer); + _out << nl << (!footer.empty() ? footer : _footer); _out << nl; } @@ -738,23 +737,24 @@ Slice::GeneratorBase::printHeaderFooter(const ContainedPtr& c) } path += imageDir + "/"; - prevImage = "<img class=\"" + prevClass + "\" src=\"" + path + prevImage + "\" alt=\"Previous\"/>"; - nextImage = "<img class=\"" + nextClass + "\" src=\"" + path + nextImage + "\" alt=\"Next\"/>"; - upImage = "<img class=\"" + upClass + "\" src=\"" + path + upImage + "\" alt=\"Up\"/>"; - homeImage = "<img class=\"Button\" src=\"" + path + homeImage + "\" alt=\"Home\"/>"; - indexImage = "<img class=\"Button\" src=\"" + path + indexImage + "\" alt=\"Index\"/>"; + prevImage = "<img class=\"" + prevClass + "\" src=\"" + path + prevImage + "\" alt=\"Previous\">"; + nextImage = "<img class=\"" + nextClass + "\" src=\"" + path + nextImage + "\" alt=\"Next\">"; + upImage = "<img class=\"" + upClass + "\" src=\"" + path + upImage + "\" alt=\"Up\">"; + homeImage = "<img class=\"Button\" src=\"" + path + homeImage + "\" alt=\"Home\">"; + indexImage = "<img class=\"Button\" src=\"" + path + indexImage + "\" alt=\"Index\">"; } _out << nl << "<!-- SwishCommand noindex -->"; - start("div", "HeaderFooter"); - - start("table", "ButtonTable"); + start("table", "HeaderFooter"); start("tr"); + start("td align=\"left\""); + start("table"); + start("tr"); start("td"); _out << "<a href=\"" << homeLink << "\">" << homeImage << "</a>"; - end(); + end(); // td if(!imageDir.empty() || !isFirst) { @@ -805,16 +805,22 @@ Slice::GeneratorBase::printHeaderFooter(const ContainedPtr& c) _out << "<a href=\"" << indexLink << "\">" << indexImage << "</a>"; end(); - end(); - end(); + end(); // tr + end(); // table + end(); // td + start("td align=\"center\""); printSearch(); + end(); + start("td align=\"right\""); printLogo(c, container, onEnumPage); + end(); - _out << nl << "<!-- SwishCommand index -->"; + end(); // tr + end(); // table - end(); + _out << nl << "<!-- SwishCommand index -->" << nl; } void @@ -822,9 +828,7 @@ Slice::GeneratorBase::printSearch() { if(!_searchAction.empty()) { - _out << nl << "<div style=\"text-align: center;\">"; - _out.inc(); - start("table", "SearchTable"); + start("table"); start("tr"); start("td"); _out << nl << "<form method=\"get\" action=\"" << _searchAction << "\"" @@ -833,14 +837,12 @@ Slice::GeneratorBase::printSearch() start("div"); _out << nl << "<input maxlength=\"100\" value=\"\" type=\"text\" name=\"query\">"; _out << nl << "<input type=\"submit\" value=\"Search\" name=\"submit\">"; - end(); _out.dec(); - _out << nl << "</form>"; - end(); - end(); end(); - _out.dec(); - _out << nl << "</div>"; + _out << nl << "</form>"; + end(); // td + end(); // tr + end(); // table } } @@ -863,7 +865,7 @@ Slice::GeneratorBase::printLogo(const ContainedPtr& c, const ContainerPtr& conta { _out << "<a href=\"" + _logoURL + "\">"; } - _out << "<img class=\"Logo\" src=\"" + path + "\" alt=\"Logo\"/>"; + _out << "<img class=\"Logo\" src=\"" + path + "\" alt=\"Logo\">"; if(!_logoURL.empty()) { _out << "</a>"; @@ -1646,9 +1648,10 @@ Slice::StartPageGenerator::generate(const ModulePtr& m) void Slice::StartPageGenerator::printHeaderFooter() { - start("div", "HeaderFooter"); - - start("table", "ButtonTable"); + start("table", "HeaderFooter"); + start("tr"); + start("td align=\"left\""); + start("table"); start("tr"); start("td"); string imageDir = getImageDir(); @@ -1659,17 +1662,21 @@ Slice::StartPageGenerator::printHeaderFooter() else { string src = imageDir + "/index.gif"; - _out << "<a href=\"_sindex.html\"><img class=\"Button\" src=\"" + src + "\" alt=\"Index Button\"/></a>"; + _out << "<a href=\"_sindex.html\"><img class=\"Button\" src=\"" + src + "\" alt=\"Index Button\"></a>"; } - end(); - end(); - end(); + end(); // td + end(); // tr + end(); // table + end(); // td + start("td align=\"center\""); printSearch(); + end(); // td if(!imageDir.empty()) { - start("table", "LogoTable"); + start("td align=\"right\""); + start("table"); start("tr"); start("td"); string logoURL = getLogoURL(); @@ -1677,17 +1684,19 @@ Slice::StartPageGenerator::printHeaderFooter() { _out << "<a href=\"" + logoURL + "\">"; } - _out << "<img class=\"Logo\" src=\"" + imageDir + "/logo.gif\" alt=\"Logo\"/>"; + _out << "<img class=\"Logo\" src=\"" + imageDir + "/logo.gif\" alt=\"Logo\">"; if(!logoURL.empty()) { _out << "</a>"; } - end(); - end(); - end(); + end(); // td + end(); // tr + end(); // table + end(); // td } - end(); + end(); // tr + end(); // table } Slice::FileVisitor::FileVisitor(Files& files) @@ -1774,6 +1783,7 @@ Slice::StartPageVisitor::visitModuleStart(const ModulePtr& m) TOCGenerator::TOCGenerator(const Files& files, const string& header, const string& footer) : GeneratorBase(_out, files) { + _footer = footer; openDoc("_sindex.html", "Slice API Index", header, footer); start("h1"); @@ -1820,7 +1830,8 @@ TOCGenerator::writeTOC() _symbols.sort(); _symbols.unique(); - closeDoc(); + string f = getFooter(_footer); + closeDoc(getFooter(_footer)); } const ContainedList& diff --git a/cpp/src/slice2html/Gen.h b/cpp/src/slice2html/Gen.h index 3709c515495..9a474e5f302 100644 --- a/cpp/src/slice2html/Gen.h +++ b/cpp/src/slice2html/Gen.h @@ -45,7 +45,7 @@ protected: void openDoc(const ::std::string&, const std::string&, const std::string& = "", const std::string& = ""); void openDoc(const ContainedPtr&); - void closeDoc(); + void closeDoc(const std::string& = ""); void start(const ::std::string&, const ::std::string& = ::std::string()); void end(); @@ -70,6 +70,8 @@ protected: static ::std::string getImageDir(); static ::std::string getLogoURL(); + static ::std::string getFooter(const ::std::string&); + ::IceUtilInternal::XMLOutput& _out; static size_t _indexCount; @@ -89,7 +91,6 @@ private: static ::std::string readFile(const ::std::string&); static void readFile(const ::std::string&, ::std::string&, ::std::string&); static void getHeaders(const ::std::string&, ::std::string&, ::std::string&); - static ::std::string getFooter(const ::std::string&); ::std::string _indexFooter; const Files _files; @@ -171,6 +172,7 @@ private: void writeEntry(const ContainedPtr&); + ::std::string _footer; ModuleList _modules; ContainedList _symbols; ::IceUtilInternal::XMLOutput _out; |