コード例 #1
0
ファイル: helpformat.cpp プロジェクト: alwanderer/gromacs
 /*! \brief
  * Returns the text for a line.
  *
  * \param[in] line  Zero-based line index.
  * \returns   Text for line \p line, or empty string if \p line has
  *     no text for this column.
  */
 std::string textForLine(int line) const
 {
     // The second conditional matches if there are no lines
     if (line < firstLine() || line > lastLine())
     {
         return std::string();
     }
     return lines_[line - firstLine()];
 }
コード例 #2
0
ファイル: main.c プロジェクト: GoodRyan/Lab5Interrupts
int main(void) {
    WDTCTL = WDTPW | WDTHOLD;	// Stop watchdog timer

    initSPI();

    LCDinit();

    LCDclear();

    unsigned char player = initPlayer();

    init_timer();
    init_buttons();
    __enable_interrupt();
   	printPlayer(player);
    while(1)
    {

    	player = movementCheck(player);
    	if(LOSE == 1){
    		LCDclear();
    		print("GAME");
    		secondLine();
    		print("OVER");
    		firstLine();
    		GAMEOVER = 1;
    		waitForP1ButtonRelease(BIT1|BIT2|BIT3|BIT4);
    		debounce();
    	}
    	if(didPlayerWin(player)){
    		LCDclear();
    		print("YOU");
    		secondLine();
    		print("WON");
    		firstLine();
    		GAMEOVER = 1;
    		waitForP1ButtonRelease(BIT1|BIT2|BIT3|BIT4);
    		debounce();
    	}
    	if(GAMEOVER){
    		char buttonsToPoll[4] = {BIT1, BIT2, BIT3, BIT4};
    		while(!pollP1Buttons(buttonsToPoll, 4)){
    			//poll until something is pressed
    		}
    		TAR = 0;
    		LOSE = 0;
    		TIMER = 0;
    		GAMEOVER = 0;
    		LCDclear();
    		player = initPlayer();
    		printPlayer(player);
    	}
    }

    return 0;
}
コード例 #3
0
ファイル: scxlvmutils.cpp プロジェクト: vrdmr/pal
    /**
       Matches the given major/minor device ID with the text read from the
       first line of the file at the given path.

       The files contents are read.  The file must have at least one line of
       text, or it is considered an exception (probably the caller sent a
       bad path in).  The first line shoud be ASCII text (a proper subset
       of UTF-8) in the form "<major> ':' <minor>".  All other text is
       ignored, but a 'normal' Sysfs dev file should contain only that text,
       so any additional text will generate a warning.

       /param[in] path   the path to a file that uses the Sysfs 'dev' file
                         format.

       /param[in] major  the expected major device ID value.

     /param[in] minor  the expected minor device ID value.

       \return This method will return true if the first line of the file at
               the given path contains "<major> ':' <minor>" and these values
               match the values passed in; false otherwise.

       \throws SCXFileSystemException  if file cannot be read or it has no
               lines of text.
     */
    bool SCXLVMUtils::MatchIdInFile(const SCXCoreLib::SCXFilePath & path, unsigned int major, unsigned int minor)
    {
        bool result = false;

        SCXCoreLib::SCXLogHandle log = SCXCoreLib::SCXLogHandleFactory::GetLogHandle(L"scx.core.common.pal.system.disk.scxlvmutils");
        std::wstringstream       out;

        // Read the file, there should be at least one line, and the first
        // line should begin with ASCII (UTF-8) text in the form <major> ':' <minor>.
        std::vector< std::wstring > lines;

        try
        {
            SCXCoreLib::SCXStream::NLFs nlfs;

            m_extDepends->ReadAllLinesAsUTF8(path, lines, nlfs);
        }
        catch (SCXCoreLib::SCXException & e)
        {
            out.str(L"");

            out << L"An exception occurred while reading the file " << path.Get() << L": " << e.What();
            SCX_LOG(log, m_errorSuppressor.GetSeverity(out.str()), out.str());

            throw;
        }

        // There should only be exactly one line containting <major> ':' <minor>
        if (lines.size() != 1)
        {
            out.str(L"");

            if (lines.size() == 0)
            {
                out << L"The file " << path.Get() << L" is empty";
                SCX_LOG(log, m_errorSuppressor.GetSeverity(out.str()), out.str());

                throw SCXBadLVMDeviceException(path, out.str(), SCXSRCLOCATION);
            }

            // This is unexpected, but it can be ignored for now.
            out << L"After reading " << path.Get() << L", expected 1 line, but found " << lines.size();
            SCX_LOG(log, m_warningSuppressor.GetSeverity(out.str()), out.str());
        }

        std::wstringstream firstLine(lines[0]);
        int                majorFromFile;
        int                minorFromFile;
        wchar_t          colon;

        firstLine >> majorFromFile >> colon >> minorFromFile;

        if ((static_cast< unsigned int >(majorFromFile) == major) &&
            (static_cast< unsigned int >(minorFromFile) == minor))
        {
            result = true;
        }

        return result;
    }
コード例 #4
0
ファイル: rlfileload.cpp プロジェクト: 376473984/pvb
int rlFileLoad::text2rlstring(rlString &rlstring)
{
  rlstring = "";
  if(loaded == 0) return -1;
  const char *line = firstLine();
  while(line != NULL)
  {
    rlstring += line;
    rlstring += "\n";
    line = nextLine();
  }
  return 0;
}
コード例 #5
0
ファイル: LCD_game.c プロジェクト: garedchapman/TheGame
void messageScroll(char * string1, char * string2){
        char * start1 = string1;
        char * current1 = string1;
        char * start2 = string2;
        char * current2 = string2;
        while(1){
                firstLine();
                current1 = scroll_help(start1, current1);
                secondLine();
                current2 = scroll_help(start2, current2);
                _delay_cycles(10000); //add test comment
        }
}
コード例 #6
0
ファイル: csvfile.cpp プロジェクト: vamsikaja/C-code
int _tmain(int argc, _TCHAR* argv[])
{
	char *s;
	int i;
	s=(char *)malloc(100*sizeof(char));
	t=(int *)malloc(100*sizeof(int));
	str=(char **)malloc(100*sizeof(char *));
	/*for(i=0;i<100;i++)
		str[i]=(char *)malloc(720*sizeof(char));*/
	printf("give the path of csv file  ");
	scanf("%s",s);
	firstLine(s);
	//tocount(s);
	return 0;
}
コード例 #7
0
void MpcImportWindow::updateTexts()
{
	QString linkText("<a href=\"http://www.minorplanetcenter.net/iau/MPEph/MPEph.html\">Minor Planet &amp; Comet Ephemeris Service</a>");
	// TRANSLATORS: A link showing the text "Minor Planet & Comet Ephemeris Service" is inserted.
	QString queryString(q_("Query the MPC's %1:"));
	ui->labelQueryLink->setText(QString(queryString).arg(linkText));
	
	QString firstLine(q_("Only one result will be returned if the query is successful."));
	QString secondLine(q_("Both comets and asteroids can be identified with their number, name (in English) or provisional designation."));
	QString cPrefix("<b>C/</b>");
	QString pPrefix("<b>P/</b>");
	QString cometQuery("<tt>C/Halley</tt>");
	QString cometName("1P/Halley");
	QString asteroidQuery("<tt>Halley</tt>");
	QString asteroidName("(2688) Halley");
	QString nameWarning(q_("Comet <i>names</i> need to be prefixed with %1 or %2. If more than one comet matches a name, only the first result will be returned. For example, searching for \"%3\" will return %4, Halley's Comet, but a search for \"%5\" will return the asteroid %6."));
	QString thirdLine = QString(nameWarning).arg(cPrefix, pPrefix, cometQuery,
	                                             cometName, asteroidQuery,
	                                             asteroidName);
	ui->labelQueryInstructions->setText(QString("%1<br/>%2<br/>%3").arg(firstLine, secondLine, thirdLine));
}
コード例 #8
0
ファイル: itemdelegate.cpp プロジェクト: Devoter/razor-qt
QSize ItemDelegate::sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const {
  if (!index.isValid()) return QSize();

  QFont normalfont = option.font;
  QFont boldfont = normalfont;
  boldfont.setBold(true);
  // Extract the items we want to measure
  QString firstRow = firstLine(index);
  QString secondRow = secondLine(index);
  // Compute the height
  QFontMetrics fm1(boldfont);
  QFontMetrics fm2(normalfont);
  int height = fm1.lineSpacing() + fm2.lineSpacing();
  height = qMax(height, option.decorationSize.height());
  // Compute the text width
  int width = fm1.width(firstRow);
  width = qMax(width, fm2.width(secondRow));
  // Add decoration width + margin
  width += option.decorationSize.width()+decorationMargin;
  return QSize(width, height+16);
}
コード例 #9
0
ファイル: TinkerFile.cpp プロジェクト: jonathandgough/cpptraj
bool TinkerFile::ID_Tinker(CpptrajFile& fileIn) {
  // NOTE: ASSUME FILE SET UP FOR READ
  if (fileIn.OpenFile()) return false;
  ArgList firstLine( fileIn.NextLine() );
  ArgList secondLine( fileIn.NextLine() );
  ArgList thirdLine( fileIn.NextLine() );
  fileIn.CloseFile();
  // First line should have <natom> <title> only
  int natom = 0;
  std::string title;
  if ( SetNatomAndTitle(firstLine, natom, title) != 0 )
    return false;
  //mprinterr("Past SetNatomAndTitle\n");
  if (secondLine.Nargs() == 6) {
    bool isBoxLine = true;
    for (int i = 0; i < 6; i++) {
      // It is a box line if all 6 tokens are doubles
      try {
        convertToDouble( secondLine.GetStringNext() );
      } 
      catch (std::runtime_error e) {
        if (i != 1) return false;
        // We found a non-double on the second character -- it could be an atom
        // name. Check that the rest of the line matches an atom record
        isBoxLine = false;
        break;
      }
    }
    // If we are here it is not a box line, so make sure 
    if (!isBoxLine) {
      return IsAtomLine(secondLine);
    } else { // our second line WAS a box, now check the 3rd line
      return IsAtomLine(thirdLine);
    }
  }
  // There is no box, check that the second line is an atom line
  return IsAtomLine(secondLine);
}
コード例 #10
0
ファイル: edfile.c プロジェクト: bcherry/bcherry
void editfile( struct options *options, list_ref list ){
   char stdinline[1024];
   char *operand = NULL;
   int stdincount = 0;
   int lineCount = 0;
   char *linepos = NULL;
   for(;;){
      if(!options->s_opt_silent)
		 printf("%s: ", progname); 
	  linepos = fgets( stdinline, sizeof stdinline, stdin );
      if( linepos == NULL ) break;
	  if(options->e_opt_echo && !options->s_opt_silent)
	     printf("%s",stdinline);
      linepos = strchr( stdinline, '\n' );
      if( linepos == NULL || stdinline[0] == '\0' ){
         badline( stdincount, stdinline );
      }else{
         *linepos = '\0';
		 operand=stdinline+1;
         switch( stdinline[0] ){
            case '$':
            	if(stdinline[1] != '\0') {
					badline(stdincount, stdinline);
					break;
				}
            	lastLine(list, options);
            	break;
            case '*':
            	if(stdinline[1] != '\0') {
					badline(stdincount, stdinline);
					break;
				}
            	printAll(list, options); 
            	break;
            case '.': 
            	if(stdinline[1] != '\0') {
					badline(stdincount, stdinline);
					break;
				}
            	printCurr(list, options);
            	break;
            case '0':
            	if(stdinline[1] != '\0') {
					badline(stdincount, stdinline);
					break;
				}
            	firstLine(list, options);
            	break;
            case '<': 
            	if(stdinline[1] != '\0') {
					badline(stdincount, stdinline);
					break;
				}
            	prevLine(list, options);
            	break;
            case '>': 
            	if(stdinline[1] != '\0') {
					badline(stdincount, stdinline);
					break;
				}
            	nextLine(list, options);
            	break;
            case '@': 
            	if(stdinline[1] != '\0') {
					badline(stdincount, stdinline);
					break;
				}
            	debugdump_list( list );
            	break;
            case 'a': 
            	insertAfter(list, operand, options);
            	break;
            case 'd': 
            	if(stdinline[1] != '\0') {
					badline(stdincount, stdinline);
					break;
				}
            	deleteLine(list, options);
            	break;
            case 'i': 
            	insertBefore(list, operand, options); 
            	break;
            case 'r':
				lineCount = readFile(list, operand, options); 
            	if(lineCount>=0 && !options->s_opt_silent)
					printf("%s: %d lines read.\n", progname, lineCount);
				break;
            case 'w': 
            	lineCount = writeFile(list, operand, options); 
            	if(lineCount>=0 && !options->s_opt_silent)
					printf("%s: %d lines written to %s\n", progname, lineCount, operand);
				break;
            default :
            	badline( stdincount, stdinline );
         };
      };
      ++stdincount;
   };
   if(!options->s_opt_silent)
	  printf("\n");
}
コード例 #11
0
ファイル: CSSSelector.cpp プロジェクト: GRGSIBERIA/EAWebKit
void CSSSelector::extractPseudoType() const
{
    if (m_match != PseudoClass && m_match != PseudoElement)
        return;

    AtomicString active("active");
    AtomicString after("after");
    AtomicString anyLink("-webkit-any-link");
    AtomicString autofill("-webkit-autofill");
    AtomicString before("before");
    AtomicString checked("checked");
    AtomicString fileUploadButton("-webkit-file-upload-button");
    AtomicString disabled("disabled");
    AtomicString drag("-webkit-drag");
    AtomicString dragAlias("-khtml-drag"); // was documented with this name in Apple documentation, so keep an alias
    AtomicString empty("empty");
    AtomicString enabled("enabled");
    AtomicString firstChild("first-child");
    AtomicString firstLetter("first-letter");
    AtomicString firstLine("first-line");
    AtomicString firstOfType("first-of-type");
    AtomicString nthChild("nth-child(");
    AtomicString nthOfType("nth-of-type(");
    AtomicString nthLastChild("nth-last-child(");
    AtomicString nthLastOfType("nth-last-of-type(");
    AtomicString focus("focus");
    AtomicString hover("hover");
    AtomicString indeterminate("indeterminate");
    AtomicString lastChild("last-child");
    AtomicString lastOfType("last-of-type");
    AtomicString link("link");
    AtomicString lang("lang(");
    AtomicString mediaControlsPanel("-webkit-media-controls-panel");
    AtomicString mediaControlsMuteButton("-webkit-media-controls-mute-button");
    AtomicString mediaControlsPlayButton("-webkit-media-controls-play-button");
    AtomicString mediaControlsTimeDisplay("-webkit-media-controls-time-display");
    AtomicString mediaControlsTimeline("-webkit-media-controls-timeline");
    AtomicString mediaControlsSeekBackButton("-webkit-media-controls-seek-back-button");
    AtomicString mediaControlsSeekForwardButton("-webkit-media-controls-seek-forward-button");
    AtomicString mediaControlsFullscreenButton("-webkit-media-controls-fullscreen-button");
    AtomicString notStr("not(");
    AtomicString onlyChild("only-child");
    AtomicString onlyOfType("only-of-type");
    AtomicString root("root");
    AtomicString searchCancelButton("-webkit-search-cancel-button");
    AtomicString searchDecoration("-webkit-search-decoration");
    AtomicString searchResultsDecoration("-webkit-search-results-decoration");
    AtomicString searchResultsButton("-webkit-search-results-button");
    AtomicString selection("selection");
    AtomicString sliderThumb("-webkit-slider-thumb");
    AtomicString target("target");
    AtomicString visited("visited");

    bool element = false; // pseudo-element
    bool compat = false; // single colon compatbility mode

    m_pseudoType = PseudoUnknown;
    if (m_value == active)
        m_pseudoType = PseudoActive;
    else if (m_value == after) {
        m_pseudoType = PseudoAfter;
        element = true;
        compat = true;
    } else if (m_value == anyLink)
        m_pseudoType = PseudoAnyLink;
    else if (m_value == autofill)
        m_pseudoType = PseudoAutofill;
    else if (m_value == before) {
        m_pseudoType = PseudoBefore;
        element = true;
        compat = true;
    } else if (m_value == checked)
        m_pseudoType = PseudoChecked;
    else if (m_value == fileUploadButton) {
        m_pseudoType = PseudoFileUploadButton;
        element = true;
    } else if (m_value == disabled)
        m_pseudoType = PseudoDisabled;
    else if (m_value == drag || m_value == dragAlias)
        m_pseudoType = PseudoDrag;
    else if (m_value == enabled)
        m_pseudoType = PseudoEnabled;
    else if (m_value == empty)
        m_pseudoType = PseudoEmpty;
    else if (m_value == firstChild)
        m_pseudoType = PseudoFirstChild;
    else if (m_value == lastChild)
        m_pseudoType = PseudoLastChild;
    else if (m_value == lastOfType)
        m_pseudoType = PseudoLastOfType;
    else if (m_value == onlyChild)
        m_pseudoType = PseudoOnlyChild;
    else if (m_value == onlyOfType)
        m_pseudoType = PseudoOnlyOfType;
    else if (m_value == firstLetter) {
        m_pseudoType = PseudoFirstLetter;
        element = true;
        compat = true;
    } else if (m_value == firstLine) {
        m_pseudoType = PseudoFirstLine;
        element = true;
        compat = true;
    } else if (m_value == firstOfType)
        m_pseudoType = PseudoFirstOfType;
    else if (m_value == focus)
        m_pseudoType = PseudoFocus;
    else if (m_value == hover)
        m_pseudoType = PseudoHover;
    else if (m_value == indeterminate)
        m_pseudoType = PseudoIndeterminate;
    else if (m_value == link)
        m_pseudoType = PseudoLink;
    else if (m_value == lang)
        m_pseudoType = PseudoLang;
    else if (m_value == mediaControlsPanel) {
        m_pseudoType = PseudoMediaControlsPanel;
        element = true;
    } else if (m_value == mediaControlsMuteButton) {
        m_pseudoType = PseudoMediaControlsMuteButton;
        element = true;
    } else if (m_value == mediaControlsPlayButton) {
        m_pseudoType = PseudoMediaControlsPlayButton;
        element = true;
    } else if (m_value == mediaControlsTimeDisplay) {
        m_pseudoType = PseudoMediaControlsTimeDisplay;
        element = true;
    } else if (m_value == mediaControlsTimeline) {
        m_pseudoType = PseudoMediaControlsTimeline;
        element = true;
    } else if (m_value == mediaControlsSeekBackButton) {
        m_pseudoType = PseudoMediaControlsSeekBackButton;
        element = true;
    } else if (m_value == mediaControlsSeekForwardButton) {
        m_pseudoType = PseudoMediaControlsSeekForwardButton;
        element = true;
    } else if (m_value == mediaControlsFullscreenButton) {
        m_pseudoType = PseudoMediaControlsFullscreenButton;
        element = true;
    } else if (m_value == notStr)
        m_pseudoType = PseudoNot;
    else if (m_value == nthChild)
        m_pseudoType = PseudoNthChild;
    else if (m_value == nthOfType)
        m_pseudoType = PseudoNthOfType;
    else if (m_value == nthLastChild)
        m_pseudoType = PseudoNthLastChild;
    else if (m_value == nthLastOfType)
        m_pseudoType = PseudoNthLastOfType;
    else if (m_value == root)
        m_pseudoType = PseudoRoot;
    else if (m_value == searchCancelButton) {
        m_pseudoType = PseudoSearchCancelButton;
        element = true;
    } else if (m_value == searchDecoration) {
        m_pseudoType = PseudoSearchDecoration;
        element = true;
    } else if (m_value == searchResultsDecoration) {
        m_pseudoType = PseudoSearchResultsDecoration;
        element = true;
    } else if (m_value == searchResultsButton) {
        m_pseudoType = PseudoSearchResultsButton;
        element = true;
    }  else if (m_value == selection) {
        m_pseudoType = PseudoSelection;
        element = true;
    } else if (m_value == sliderThumb) {
        m_pseudoType = PseudoSliderThumb;
        element = true;
    } else if (m_value == target)
        m_pseudoType = PseudoTarget;
    else if (m_value == visited)
        m_pseudoType = PseudoVisited;

    if (m_match == PseudoClass && element) {
        if (!compat)
            m_pseudoType = PseudoUnknown;
        else
            m_match = PseudoElement;
    } else if (m_match == PseudoElement && !element)
        m_pseudoType = PseudoUnknown;
}
コード例 #12
0
ファイル: Executable.cpp プロジェクト: buchongyu/webkit
RefPtr<CodeBlock> ScriptExecutable::newCodeBlockFor(
    CodeSpecializationKind kind, JSFunction* function, JSScope* scope, JSObject*& exception)
{
    VM* vm = scope->vm();

    ASSERT(vm->heap.isDeferred());
    ASSERT(startColumn() != UINT_MAX);
    ASSERT(endColumn() != UINT_MAX);

    if (classInfo() == EvalExecutable::info()) {
        EvalExecutable* executable = jsCast<EvalExecutable*>(this);
        RELEASE_ASSERT(kind == CodeForCall);
        RELEASE_ASSERT(!executable->m_evalCodeBlock);
        RELEASE_ASSERT(!function);
        return adoptRef(new EvalCodeBlock(
            executable, executable->m_unlinkedEvalCodeBlock.get(), scope,
            executable->source().provider()));
    }
    
    if (classInfo() == ProgramExecutable::info()) {
        ProgramExecutable* executable = jsCast<ProgramExecutable*>(this);
        RELEASE_ASSERT(kind == CodeForCall);
        RELEASE_ASSERT(!executable->m_programCodeBlock);
        RELEASE_ASSERT(!function);
        return adoptRef(new ProgramCodeBlock(
            executable, executable->m_unlinkedProgramCodeBlock.get(), scope,
            executable->source().provider(), executable->source().startColumn()));
    }
    
    RELEASE_ASSERT(classInfo() == FunctionExecutable::info());
    RELEASE_ASSERT(function);
    FunctionExecutable* executable = jsCast<FunctionExecutable*>(this);
    RELEASE_ASSERT(!executable->codeBlockFor(kind));
    JSGlobalObject* globalObject = scope->globalObject();
    ParserError error;
    DebuggerMode debuggerMode = globalObject->hasDebugger() ? DebuggerOn : DebuggerOff;
    ProfilerMode profilerMode = globalObject->hasProfiler() ? ProfilerOn : ProfilerOff;
    UnlinkedFunctionCodeBlock* unlinkedCodeBlock =
    executable->m_unlinkedExecutable->codeBlockFor(*vm, executable->m_source, kind, debuggerMode, profilerMode, error, executable->isArrowFunction());
    recordParse(executable->m_unlinkedExecutable->features(), executable->m_unlinkedExecutable->hasCapturedVariables(), firstLine(), lastLine(), startColumn(), endColumn()); 
    if (!unlinkedCodeBlock) {
        exception = vm->throwException(
            globalObject->globalExec(),
            error.toErrorObject(globalObject, executable->m_source));
        return nullptr;
    }

    SourceProvider* provider = executable->source().provider();
    unsigned sourceOffset = executable->source().startOffset();
    unsigned startColumn = executable->source().startColumn();

    return adoptRef(new FunctionCodeBlock(
        executable, unlinkedCodeBlock, scope, provider, sourceOffset, startColumn));
}
コード例 #13
0
int main()
{
    firstLine();
    initializer();
    return menu();
}
コード例 #14
0
std::string mitk::PACSPlugin::GuessMIMEType( const std::string& filename )
{
  std::ifstream file( filename.c_str() );
  if (!file)
  {
    // cannot open file
    return std::string("");
  }

  const unsigned int maxLength = 8;
  unsigned char line[ maxLength];
  file.getline( reinterpret_cast<char*>(line), maxLength );
  file.close();

  std::string firstLine( reinterpret_cast<char*>(line) );

  if ( firstLine.substr( 1, 3 ) == "PDF" )
  {
    return std::string("application/pdf");
  }

  if ( firstLine.substr( 0, 5 ) == "{\\rtf" )
  {
    return std::string("text/richtext");
  }

  if ( firstLine.substr( 0, 2 ) == "PK" )
  {
    return std::string("application/zip");
  }

  if ( (line[0] == 0xFF) && (line[1] == 0xD8) )
  {
    return std::string("image/jpeg");
  }

  if ( (line[0] == 0x89) &&
       (line[1] == 0x50) &&
       (line[2] == 0x4E) &&
       (line[3] == 0x47) &&
       (line[4] == 0x0D) &&
       (line[5] == 0x0A) &&
       (line[6] == 0x1A) &&
       (line[7] == 0x0A)
     )
  {
    return std::string("image/png");
  }

  if ( (line[0] == 0x4D) && (line[1] == 0x5A) )
  {
    //return std::string("application/octet-stream");
    return std::string("Windows EXE");
  }

  if ( ( filename.rfind( ".stl" ) == filename.length() - 4 ) ||
       ( filename.rfind( ".STL" ) == filename.length() - 4 ) )
  {
    // this is a guess. don't know a good way to test for STL.
    return std::string("application/sla");
  }

  if ( ( filename.rfind( ".txt" ) == filename.length() - 4 ) ||
       ( filename.rfind( ".TXT" ) == filename.length() - 4 ) )
  {
    // this is a guess. don't know a good way to test for STL.
    return std::string("text/plain");
  }

  return std::string("");
}