⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 osutil.inl

📁 mgcp协议源代码。支持多种编码:g711
💻 INL
📖 第 1 页 / 共 2 页
字号:
  { struct tm ts; return os_localtime(&theTime, &ts)->tm_year+1900; }PINLINE PTime::Weekdays PTime::GetDayOfWeek() const  { struct tm ts; return (Weekdays)os_localtime(&theTime, &ts)->tm_wday; }PINLINE int PTime::GetDayOfYear() const  { struct tm ts; return os_localtime(&theTime, &ts)->tm_yday; }PINLINE BOOL PTime::IsPast() const  { return theTime < time(NULL); }PINLINE BOOL PTime::IsFuture() const  { return theTime > time(NULL); }PINLINE PString PTime::AsString(const PString & format, int zone) const  { return AsString((const char *)format, zone); }PINLINE int PTime::GetTimeZone()   { return GetTimeZone(IsDaylightSavings() ? DaylightSavings : StandardTime); }///////////////////////////////////////////////////////////////////////////////// PTimerPINLINE BOOL PTimer::IsRunning() const  { return state == Starting || state == Running; }PINLINE BOOL PTimer::IsPaused() const  { return state == Paused; }PINLINE const PNotifier & PTimer::GetNotifier() const  { return callback; }PINLINE void PTimer::SetNotifier(const PNotifier & func)  { callback = func; }///////////////////////////////////////////////////////////////////////////////PINLINE PChannelStreamBuffer::PChannelStreamBuffer(const PChannelStreamBuffer & sbuf)  : channel(sbuf.channel) { }PINLINE PChannelStreamBuffer &          PChannelStreamBuffer::operator=(const PChannelStreamBuffer & sbuf)  { channel = sbuf.channel; return *this; }PINLINE PChannel::PChannel(const PChannel &)  { PAssertAlways("Cannot copy channels"); }PINLINE PChannel & PChannel::operator=(const PChannel &)  { PAssertAlways("Cannot assign channels"); return *this; }PINLINE void PChannel::SetReadTimeout(const PTimeInterval & time)  { readTimeout = time; }PINLINE PTimeInterval PChannel::GetReadTimeout() const  { return readTimeout; }PINLINE PINDEX PChannel::GetLastReadCount() const  { return lastReadCount; }PINLINE void PChannel::SetWriteTimeout(const PTimeInterval & time)  { writeTimeout = time; }PINLINE PTimeInterval PChannel::GetWriteTimeout() const  { return writeTimeout; }PINLINE PINDEX PChannel::GetLastWriteCount() const  { return lastWriteCount; }PINLINE int PChannel::GetHandle() const  { return os_handle; }PINLINE PChannel::Errors PChannel::GetErrorCode() const  { return lastError; }PINLINE int PChannel::GetErrorNumber() const  { return osError; }PINLINE void PChannel::AbortCommandString()  { abortCommandString = TRUE; }///////////////////////////////////////////////////////////////////////////////// PIndirectChannelPINLINE PIndirectChannel::~PIndirectChannel()  { Close(); }PINLINE PChannel * PIndirectChannel::GetReadChannel() const  { return readChannel; }PINLINE PChannel * PIndirectChannel::GetWriteChannel() const  { return writeChannel; }///////////////////////////////////////////////////////////////////////////////// PDirectoryPINLINE PDirectory::PDirectory()  : PFilePathString(".") { Construct(); }PINLINE PDirectory::PDirectory(const char * cpathname)    : PFilePathString(cpathname) { Construct(); }  PINLINE PDirectory::PDirectory(const PString & pathname)  : PFilePathString(pathname) { Construct(); }  PINLINE void PDirectory::DestroyContents()  { Close(); PFilePathString::DestroyContents(); }PINLINE BOOL PDirectory::Exists() const  { return Exists(*this); }PINLINE BOOL PDirectory::Change() const  { return Change(*this); }PINLINE BOOL PDirectory::Create(int perm) const  { return Create(*this, perm); }PINLINE BOOL PDirectory::Remove()  { Close(); return Remove(*this); }///////////////////////////////////////////////////////////////////////////////PINLINE PFilePath::PFilePath()  { }PINLINE PFilePath::PFilePath(const PFilePath & path)  : PFilePathString(path) { }PINLINE PFilePath & PFilePath::operator=(const char * cstr)  { return operator=(PString(cstr)); }PINLINE PFilePath & PFilePath::operator=(const PFilePath & path)  { PFilePathString::operator=(path); return *this; }PINLINE PFilePath & PFilePath::operator+=(const PString & str)  { operator=(*this + str); return *this; }PINLINE PFilePath & PFilePath::operator+=(const char * cstr)  { operator=(*this + cstr); return *this; }PINLINE PFilePath & PFilePath::operator+=(char ch)  { operator=(*this + ch); return *this; }///////////////////////////////////////////////////////////////////////////////PINLINE PFile::PFile()  { os_handle = -1; removeOnClose = FALSE; }PINLINE PFile::PFile(OpenMode mode, int opts)  { os_handle = -1; removeOnClose = FALSE; Open(mode, opts); }PINLINE PFile::PFile(const PFilePath & name, OpenMode mode, int opts)  { os_handle = -1; removeOnClose = FALSE; Open(name, mode, opts); }PINLINE BOOL PFile::Exists() const  { return Exists(path); }PINLINE BOOL PFile::Access(OpenMode mode)  { return ConvertOSError(Access(path, mode) ? 0 : -1); }PINLINE BOOL PFile::Remove(BOOL force)  { Close(); return ConvertOSError(Remove(path, force) ? 0 : -1); }PINLINE BOOL PFile::Copy(const PFilePath & newname, BOOL force)  { return ConvertOSError(Copy(path, newname, force) ? 0 : -1); }PINLINE BOOL PFile::GetInfo(PFileInfo & info)  { return ConvertOSError(GetInfo(path, info) ? 0 : -1); }PINLINE BOOL PFile::SetPermissions(int permissions)  { return ConvertOSError(SetPermissions(path, permissions) ? 0 : -1); }PINLINE const PFilePath & PFile::GetFilePath() const  { return path; }      PINLINE PString PFile::GetName() const  { return path; }PINLINE off_t PFile::GetPosition() const  { return _lseek(GetHandle(), 0, SEEK_CUR); }///////////////////////////////////////////////////////////////////////////////PINLINE PTextFile::PTextFile()  { }PINLINE PTextFile::PTextFile(OpenMode mode, int opts)  { Open(mode, opts); }PINLINE PTextFile::PTextFile(const PFilePath & name, OpenMode mode, int opts)  { Open(name, mode, opts); }///////////////////////////////////////////////////////////////////////////////// PConfig#ifdef _PCONFIGPINLINE PConfig::PConfig(Source src)  : defaultSection("Options") { Construct(src, "", ""); }PINLINE PConfig::PConfig(Source src, const PString & appname)  : defaultSection("Options") { Construct(src, appname, ""); }PINLINE PConfig::PConfig(Source src, const PString & appname, const PString & manuf)  : defaultSection("Options") { Construct(src, appname, manuf); }PINLINE PConfig::PConfig(const PString & section, Source src)  : defaultSection(section) { Construct(src, "", ""); }PINLINE PConfig::PConfig(const PString & section, Source src, const PString & appname)  : defaultSection(section) { Construct(src, appname, ""); }PINLINE PConfig::PConfig(const PString & section,                         Source src,                         const PString & appname,                         const PString & manuf)  : defaultSection(section) { Construct(src, appname, manuf); }PINLINE PConfig::PConfig(const PFilePath & filename, const PString & section)  : defaultSection(section) { Construct(filename); }PINLINE void PConfig::SetDefaultSection(const PString & section)  { defaultSection = section; }PINLINE PString PConfig::GetDefaultSection() const  { return defaultSection; }PINLINE PStringList PConfig::GetKeys() const  { return GetKeys(defaultSection); }PINLINE PStringToString PConfig::GetAllKeyValues() const  { return GetAllKeyValues(defaultSection); }PINLINE void PConfig::DeleteSection()  { DeleteSection(defaultSection); }PINLINE void PConfig::DeleteKey(const PString & key)  { DeleteKey(defaultSection, key); }PINLINE BOOL PConfig::HasKey(const PString & key) const  { return HasKey(defaultSection, key); }PINLINE PString PConfig::GetString(const PString & key) const  { return GetString(defaultSection, key, PString()); }PINLINE PString PConfig::GetString(const PString & key, const PString & dflt) const  { return GetString(defaultSection, key, dflt); }PINLINE void PConfig::SetString(const PString & key, const PString & value)  { SetString(defaultSection, key, value); }PINLINE BOOL PConfig::GetBoolean(const PString & key, BOOL dflt) const  { return GetBoolean(defaultSection, key, dflt); }PINLINE void PConfig::SetBoolean(const PString & key, BOOL value)  { SetBoolean(defaultSection, key, value); }PINLINE long PConfig::GetInteger(const PString & key, long dflt) const  { return GetInteger(defaultSection, key, dflt); }PINLINE void PConfig::SetInteger(const PString & key, long value)  { SetInteger(defaultSection, key, value); }PINLINE PInt64 PConfig::GetInt64(const PString & key, PInt64 dflt) const  { return GetInt64(defaultSection, key, dflt); }PINLINE void PConfig::SetInt64(const PString & key, PInt64 value)  { SetInt64(defaultSection, key, value); }PINLINE double PConfig::GetReal(const PString & key, double dflt) const  { return GetReal(defaultSection, key, dflt); }PINLINE void PConfig::SetReal(const PString & key, double value)  { SetReal(defaultSection, key, value); }PINLINE PTime PConfig::GetTime(const PString & key) const  { return GetTime(defaultSection, key); }PINLINE PTime PConfig::GetTime(const PString & key, const PTime & dflt) const  { return GetTime(defaultSection, key, dflt); }PINLINE void PConfig::SetTime(const PString & key, const PTime & value)  { SetTime(defaultSection, key, value); }#endif///////////////////////////////////////////////////////////////////////////////// PArgListPINLINE void PArgList::SetArgs(int argc, char ** argv)  { SetArgs(PStringArray(argc, argv)); }PINLINE BOOL PArgList::Parse(const PString & theArgumentSpec, BOOL optionsBeforeParams)  { return Parse((const char *)theArgumentSpec, optionsBeforeParams); }PINLINE BOOL PArgList::HasOption(char option) const  { return GetOptionCount(option) != 0; }PINLINE BOOL PArgList::HasOption(const char * option) const  { return GetOptionCount(option) != 0; }PINLINE BOOL PArgList::HasOption(const PString & option) const  { return GetOptionCount(option) != 0; }PINLINE PINDEX PArgList::GetCount() const  { return parameterIndex.GetSize()-shift; }PINLINE PString PArgList::operator[](PINDEX num) const  { return GetParameter(num); }PINLINE PArgList & PArgList::operator<<(int sh)  { Shift(sh); return *this; }PINLINE PArgList & PArgList::operator>>(int sh)  { Shift(-sh); return *this; }///////////////////////////////////////////////////////////////////////////////// PSemaphorePINLINE PWaitAndSignal::PWaitAndSignal(PSemaphore & sem)  : semaphore(sem) { semaphore.Wait(); }PINLINE PWaitAndSignal::~PWaitAndSignal()  { semaphore.Signal(); }///////////////////////////////////////////////////////////////////////////////// PThread#ifndef P_PLATFORM_HAS_THREADSPINLINE PThread * PThread::Current()  { return PProcess::Current().currentThread; }PINLINE BOOL PThread::IsTerminated() const  { return status == Terminated; }PINLINE void PThread::Resume()  { Suspend(FALSE); }PINLINE BOOL PThread::IsSuspended() const  { return suspendCount > 0; }PINLINE void PThread::SetPriority(Priority priorityLevel)  { basePriority = priorityLevel; }PINLINE PThread::Priority PThread::GetPriority() const  { return basePriority; }#endif///////////////////////////////////////////////////////////////////////////////// PProcessPINLINE PArgList & PProcess::GetArguments()  { return arguments; }PINLINE const PString & PProcess::GetManufacturer() const  { return manufacturer; }PINLINE const PString & PProcess::GetName() const  { return productName; }PINLINE const PFilePath & PProcess::GetFile() const  { return executableFile; }PINLINE PTimerList * PProcess::GetTimerList()  { return &timers; }PINLINE void PProcess::SetTerminationValue(int value)  { terminationValue = value; }PINLINE int PProcess::GetTerminationValue() const  { return terminationValue; }// End Of File ///////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -