MCPcopy Create free account
hub / github.com/MediaArea/MediaInfoLib / Option

Method Option

Source/MediaInfo/MediaInfo_Config.cpp:655–1812  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

653}
654
655Ztring MediaInfo_Config::Option (const String &Option, const String &Value_Raw)
656{
657 {
658 CriticalSectionLocker CSL(CS);
659 SubFile_Config(Option)=Value_Raw;
660 }
661
662 String Option_Lower(Option);
663 size_t Egal_Pos=Option_Lower.find(__T('='));
664 if (Egal_Pos==string::npos)
665 Egal_Pos=Option_Lower.size();
666 transform(Option_Lower.begin(), Option_Lower.begin()+Egal_Pos, Option_Lower.begin(), (int(*)(int))tolower); //(int(*)(int)) is a patch for unix
667
668 //Parsing pointer to a file
669 Ztring Value;
670 #if defined(MEDIAINFO_FILE_YES)
671 if (Value_Raw.find(__T("file://"))==0)
672 {
673 //Open
674 Ztring FileName(Value_Raw, 7, Ztring::npos);
675 File F(FileName.c_str());
676
677 //Read
678 int64u Size=F.Size_Get();
679 if (Size>=0xFFFFFFFF)
680 Size=1024*1024;
681 int8u* Buffer=new int8u[(size_t)Size+1];
682 size_t Pos=F.Read(Buffer, (size_t)Size);
683 F.Close();
684 Buffer[Pos]='\0';
685 Ztring FromFile; FromFile.From_UTF8((char*)Buffer);
686 if (FromFile.empty())
687 FromFile.From_UTF8((char*)Buffer);
688 delete[] Buffer; //Buffer=NULL;
689
690 //Merge
691 Value=FromFile;
692 }
693 else
694 #endif //defined(MEDIAINFO_FILE_YES)
695 if (Value_Raw.substr(0, 7)==__T("cstr://"))
696 {
697 Value=_DecodeEscapeC(Value_Raw.begin() + 7, Value_Raw.end());
698 }
699 else
700 Value=Value_Raw;
701
702 if (Option_Lower.empty())
703 {
704 return Ztring();
705 }
706 if (Option_Lower==__T("charset_config"))
707 {
708 return Ztring(); //Only used in DLL, no Library action
709 }
710 if (Option_Lower==__T("charset_output"))
711 {
712 return Ztring(); //Only used in DLL, no Library action

Callers

nothing calls this directly

Calls 10

_DecodeEscapeCFunction · 0.85
OptionClass · 0.85
Quote_SetMethod · 0.80
CloseMethod · 0.65
sizeMethod · 0.45
beginMethod · 0.45
c_strMethod · 0.45
emptyMethod · 0.45
endMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected