I'm working on moding the the lllogchat.ccp to add a datestamp to the file
name but im having dificuilitie with getting it to work roght of fail to
compile. The following erros are from my latest compile:

 

94>lllogchat.cpp

94>lllocationinputctrl.cpp

94>..\..\newview\lllogchat.cpp(196) : error C2065: 'ostringstream' :
undeclared identifier

94>..\..\newview\lllogchat.cpp(196) : error C2146: syntax error : missing
';' before identifier 'date'

94>..\..\newview\lllogchat.cpp(196) : error C2275: 'boost::gregorian::date'
: illegal use of this type as an expression

94>
C:\linden\projects\2010\snowglobe\trunk\libraries\include\boost/date_time/gr
egorian/greg_date.hpp(37) : see declaration of 'boost::gregorian::date'

94>..\..\newview\lllogchat.cpp(197) : error C2143: syntax error : missing
';' before '<<'

94>..\..\newview\lllogchat.cpp(197) : error C2143: syntax error : missing
';' before '<<'

94>..\..\newview\lllogchat.cpp(198) : warning C4832: token '.' is illegal
after UDT 'LLLogChat::makeLogFileName::date'

94>        ..\..\newview\lllogchat.cpp(197) : see declaration of
'LLLogChat::makeLogFileName::date'

94>..\..\newview\lllogchat.cpp(198) : error C2027: use of undefined type
'LLLogChat::makeLogFileName::date'

94>        ..\..\newview\lllogchat.cpp(197) : see declaration of
'LLLogChat::makeLogFileName::date'

94>..\..\newview\lllogchat.cpp(198) : error C2228: left of '.str' must have
class/struct/union

94>..\..\newview\lllogchat.cpp(203) : error C2146: syntax error : missing
';' before identifier 'date'

94>..\..\newview\lllogchat.cpp(203) : error C2275: 'boost::gregorian::date'
: illegal use of this type as an expression

94>
C:\linden\projects\2010\snowglobe\trunk\libraries\include\boost/date_time/gr
egorian/greg_date.hpp(37) : see declaration of 'boost::gregorian::date'

94>..\..\newview\lllogchat.cpp(204) : error C2143: syntax error : missing
';' before '<<'

94>..\..\newview\lllogchat.cpp(204) : error C2143: syntax error : missing
';' before '<<'

94>..\..\newview\lllogchat.cpp(205) : warning C4832: token '.' is illegal
after UDT 'boost::gregorian::date'

94>
C:\linden\projects\2010\snowglobe\trunk\libraries\include\boost/date_time/gr
egorian/greg_date.hpp(37) : see declaration of 'boost::gregorian::date'

94>..\..\newview\lllogchat.cpp(205) : error C2039: 'str' : is not a member
of 'boost::gregorian::date'

94>
C:\linden\projects\2010\snowglobe\trunk\libraries\include\boost/date_time/gr
egorian/greg_date.hpp(37) : see declaration of 'boost::gregorian::date'

 

Here is the related code:

 

std::string LLLogChat::makeLogFileName(std::string filename)

{

      time_t now = time(NULL);

    struct tm * t = localtime(&now);

    if (filename == "chat")

      {

            ostringstream date;

            date << "-" << t->tm_year << "-" << t->tm_mon << "-" <<
t->tm_mday;

            std::string formated_date = date.str();

            filename += formated_date;

      }

      else

      {

            ostringstream date;

            date << "-" << t->tm_year << "-" << t->tm_mon;

            std::string formated_date = date.str();

            filename += formated_date;

      }

      filename = cleanFileName(filename);

      filename =
gDirUtilp->getExpandedFilename(LL_PATH_PER_ACCOUNT_CHAT_LOGS,filename);

      filename += ".txt";

      return filename;

}

 

I'm trying to do something similar to this section of code:

 

std::string LLLogChat::timestamp(bool withdate)

{

      time_t utc_time;

      utc_time = time_corrected();

 

      std::string timeStr;

      LLSD substitution;

      substitution["datetime"] = (S32) utc_time;

 

      if (withdate)

      {

            timeStr = "["+LLTrans::getString ("TimeYear")+"]/["

                      +LLTrans::getString ("TimeMonth")+"]/["

                          +LLTrans::getString ("TimeDay")+"] ["

                          +LLTrans::getString ("TimeHour")+"]:["

                          +LLTrans::getString ("TimeMin")+"]";

      }

      else

      {

            timeStr = "[" + LLTrans::getString("TimeHour") + "]:["

                        + LLTrans::getString ("TimeMin")+"]";

      }

 

      LLStringUtil::format (timeStr, substitution);

      return timeStr;

}

 

When I tried this modification to the code:

 

std::string LLLogChat::makeLogFileName(std::string filename)

{

      time_t utc_time;

      utc_time = time_corrected();

      std::string timeStr;

      LLSD substitution;

      substitution["datetime"] = (S32) utc_time;

      if (filename == "chat" )

      {

            timeStr = "-"+LLTrans::getString ("TimeYear")+"-"

                      +LLTrans::getString ("TimeMonth")+"-"

    +LLTrans::getString ("TimeDay");

      }

      else

      {

            timeStr = "[" + LLTrans::getString("TimeHour") + "]:["

                        + LLTrans::getString ("TimeMin")+"]";

      }

 

      LLStringUtil::format (timeStr, substitution);

      filename += timeStr;

      filename = cleanFileName(filename);

      filename =
gDirUtilp->getExpandedFilename(LL_PATH_PER_ACCOUNT_CHAT_LOGS,filename);

      filename += ".txt";

      return filename;

}

 

It would compile just fine but I wouls get
chat-year,datetime,slt-mthnum,datetime,slt-day,datetime,slt as the file name
instead of chat-2010-04-19 for the file name which is what I want

 

 

 

 

 

 

_______________________________________________
Policies and (un)subscribe information available here:
http://wiki.secondlife.com/wiki/OpenSource-Dev
Please read the policies before posting to keep unmoderated posting privileges

Reply via email to