当前位置: 首页>>代码示例>>C++>>正文


C++ Print类代码示例

本文整理汇总了C++中Print的典型用法代码示例。如果您正苦于以下问题:C++ Print类的具体用法?C++ Print怎么用?C++ Print使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Print类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: print_channel_state

void slave_status::print_channel_state(Print& out, const channel_state_t& state)
{
    switch (state)
    {
    case channel_working:
        out.print("Working Normally");
        break;

    case channel_disconnected:
        out.print("Disconnected / Solenoid Not Found");
        break;

    case channel_failed_short:
        out.print("Short-Circuited");
        break;

    case channel_failed_open:
        out.print("Failed Open-Circuit");
        break;

    default:
        out.print("Unknown / Invalid Channel Status");
        break;
    }
}
开发者ID:DAVe3283,项目名称:MIDI-Chimes,代码行数:25,代码来源:slave_status.cpp

示例2: LoadHeader

void CApplicationMonitor::Dump(Print &rDestination, bool bOnlyIfPresent) const
{
  CApplicationMonitorHeader Header;
  CCrashReport Report;
  uint8_t uReport;
  uint32_t uAddress;

  LoadHeader(Header);
  if (!bOnlyIfPresent || Header.m_uSavedReports != 0)
  {
    rDestination.println(F("Application Monitor"));
    rDestination.println(F("-------------------"));
    PrintValue(rDestination, F("Saved reports: "), Header.m_uSavedReports, DEC, true);
    PrintValue(rDestination, F("Next report: "), Header.m_uNextReport, DEC, true);

    for (uReport = 0; uReport < Header.m_uSavedReports; ++uReport)
    {
      LoadReport(uReport, Report);

      rDestination.print(uReport);
      uAddress = 0;
      memcpy(&uAddress, Report.m_auAddress, PROGRAM_COUNTER_SIZE);
      PrintValue(rDestination, F(": word-address=0x"), uAddress, HEX, false);
      PrintValue(rDestination, F(": byte-address=0x"), uAddress * 2, HEX, false);
      PrintValue(rDestination, F(", data=0x"), Report.m_uData, HEX, true);
    }
  }
}
开发者ID:UnforeseenOcean,项目名称:Highsight,代码行数:28,代码来源:ApplicationMonitor.cpp

示例3: printdesc

void GAnalogSensor::printdesc(Print& prn)
{
	// e.g. A0:
	prn.print(F("A"));
	prn.print(_pin);
	prn.print(F(": "));
}
开发者ID:xingzhongshu,项目名称:On_Board_Diagnostic,代码行数:7,代码来源:GAnalogSensor.cpp

示例4: send

void OSCBundle::send(Print &p){
    //don't send a bundle with errors
    if (hasError()){
        return;
    }
    //write the bundle header
    static uint8_t header[] = {'#', 'b', 'u', 'n', 'd', 'l', 'e', 0};
    p.write(header, 8);
    //write the timetag
{
    osctime_t time =  timetag;
    uint32_t d = BigEndian(time.seconds);
    uint8_t * ptr = (uint8_t *)    &d;
    p.write(ptr, 4);
    d = BigEndian(time.fractionofseconds);
    ptr = (uint8_t *)    &d;
    p.write(ptr, 4);
}

    //send the messages
    for (int i = 0; i < numMessages; i++){
        OSCMessage * msg = getOSCMessage(i);
        int msgSize = msg->bytes();
        //turn the message size into a pointer
        uint32_t s32 = BigEndian((uint32_t) msgSize);
        uint8_t * sptr = (uint8_t *) &s32;
        //write the messsage size
        p.write(sptr, 4);
        msg->send(p);
    }
}
开发者ID:ArduinoBR,项目名称:OSC,代码行数:31,代码来源:OSCBundle.cpp

示例5: printDigits

void printDigits(Print &print, int digits) {
	// utility function for digital clock display: prints preceding colon and leading 0
	print.print(":");
	if (digits < 10)
		print.print('0');
	print.print(digits);
}
开发者ID:dcupovic,项目名称:arduino,代码行数:7,代码来源:DS1302Time.cpp

示例6: printTo

size_t IPAddress::printTo(Print& p) const {
    size_t n = 0;

    if (!isSet())
        return p.print(F("(IP unset)"));

#if LWIP_IPV6
    if (isV6()) {
        int count0 = 0;
        for (int i = 0; i < 8; i++) {
            uint16_t bit = PP_NTOHS(raw6()[i]);
            if (bit || count0 < 0) {
                n += p.printf("%x", bit);
                if (count0 > 0)
                    // no more hiding 0
                    count0 = -8;
            } else
                count0++;
            if ((i != 7 && count0 < 2) || count0 == 7)
                n += p.print(':');
        }
        return n;
    }
#endif

    for(int i = 0; i < 4; i++) {
        n += p.print((*this)[i], DEC);
        if (i != 3)
            n += p.print('.');
    }
    return n;
}
开发者ID:Juppit,项目名称:Arduino,代码行数:32,代码来源:IPAddress.cpp

示例7: setDateFromStream

void setDateFromStream(Stream &in, Print& out) {
  out.print("set date (MM/DD/YYYY): ");
  int month, day, year;
  int val = in.peek();
  while(val <= ' ') {
    in.read();
    val = in.peek();
  }
  do {
    month = in.parseInt();
  } while(month == 0);
  if(in.peek() != '/') {
    out.println("Syntax error");
    return;
  } 
  day = in.parseInt();
  if(in.peek() != '/') {
    out.println("Syntax error");
    return;
  }
  year = in.parseInt();
  
  if(year < 100) {
    year += 2000;
  }
  
  rtc_clock.set_date(day, month, year);
}
开发者ID:tuofeichen,项目名称:SmartTree-Electrical,代码行数:28,代码来源:debug.cpp

示例8: booleanValue

void JsonPrinter::booleanValue(Print& printer, boolean value) {
    if (value == true) {
        printer.print("true");
    } else {
        printer.print("false");
    }
}
开发者ID:rbender,项目名称:SimpleSensors,代码行数:7,代码来源:JsonPrinter.cpp

示例9: setTimeFromStream

void setTimeFromStream(Stream &in, Print& out) {
  out.print("set time (HH:MM:SS): ");
  int second, minute, hour;
  int val = in.peek();
  while(val < '0' || val > '9') {
    if(val > ' ') {
      out.println("Syntax error");
      return;
    }
    in.read();
    val = in.peek();
  }
  
  hour = in.parseInt();
  if(in.peek() != ':') {
    out.println("Syntax error");
    return;
  }
  minute = in.parseInt();
  if(in.peek() != ':') {
    second = 0;
  } else {
    second = in.parseInt();
  }
  rtc_clock.set_time(hour, minute, second);
}
开发者ID:tuofeichen,项目名称:SmartTree-Electrical,代码行数:26,代码来源:debug.cpp

示例10: printTo

size_t JsonObjectBase::printTo(Print& p) const
{
    size_t n = 0;

    n += p.write('{');

    // NB: the code has been optimized for a small size on a 8-bit AVR

    const KeyValuePair* current = items;
    for (int i = count; i > 0; i--)
    {       
        n += EscapedString::printTo(current->key, p);
        n += p.write(':');
        n += current->value.printTo(p);

        current++;

        if (i > 1)
        {
            n += p.write(',');
        }
    }

    n += p.write('}');

    return n;
}
开发者ID:GardenInsight,项目名称:ArduinoJson,代码行数:27,代码来源:JsonObjectBase.cpp

示例11: printErrorCb

void printErrorCb(TxStatusResponse& r, uintptr_t data) {
	Print *p = (Print*)data;
	if (!r.isSuccess()) {
		p->print(F("Error sending packet. Delivery status: "));
		p->println(r.getStatus());
	}
}
开发者ID:Introsys,项目名称:fresh,代码行数:7,代码来源:Printers.cpp

示例12: digitalDateDisplay

void digitalDateDisplay(Print& print) {
	print.print(day());
	print.print(".");
	print.print(month());
	print.print(".");
	print.print(year());
}
开发者ID:dcupovic,项目名称:arduino,代码行数:7,代码来源:DS1302Time.cpp

示例13: digitalClockDisplay

void digitalClockDisplay(Print &print) {
	// digital clock display of the time
	digitalTimeDisplay(print);
	print.print(" ");
	digitalDateDisplay(print);
	print.println();
}
开发者ID:dcupovic,项目名称:arduino,代码行数:7,代码来源:DS1302Time.cpp

示例14: PrintValue

void CApplicationMonitor::PrintValue(Print &rDestination, const __FlashStringHelper *pLabel, 
                                     uint32_t uValue, uint8_t uRadix, bool bNewLine) const
{
  rDestination.print(pLabel);
  rDestination.print(uValue, uRadix);
  if (bNewLine)
    rDestination.println();
}
开发者ID:UnforeseenOcean,项目名称:Highsight,代码行数:8,代码来源:ApplicationMonitor.cpp

示例15: printCharTo

static inline size_t printCharTo(char c, Print& p)
{
    char specialChar = getSpecialChar(c);

    return specialChar != 0
        ? p.write('\\') + p.write(specialChar)
        : p.write(c);
}
开发者ID:Mezomish,项目名称:ArduinoJson,代码行数:8,代码来源:EscapedString.cpp


注:本文中的Print类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。